@@ -33,18 +33,6 @@ type Chain struct {
33
33
// corresponding blocks in the Engine.
34
34
LatestProducedCommitment reactive.Variable [* Commitment ]
35
35
36
- // ClaimedWeight contains the claimed weight of this chain which is derived from the cumulative weight of the
37
- // LatestCommitment.
38
- ClaimedWeight reactive.Variable [uint64 ]
39
-
40
- // AttestedWeight contains the attested weight of this chain which is derived from the cumulative weight of all
41
- // attestations up to the LatestAttestedCommitment.
42
- AttestedWeight reactive.Variable [uint64 ]
43
-
44
- // VerifiedWeight contains the verified weight of this chain which is derived from the cumulative weight of the
45
- // latest verified commitment.
46
- VerifiedWeight reactive.Variable [uint64 ]
47
-
48
36
// WarpSyncMode contains a flag that indicates whether this chain is in warp sync mode.
49
37
WarpSyncMode reactive.Variable [bool ]
50
38
@@ -88,9 +76,6 @@ func newChain(chains *Chains) *Chain {
88
76
LatestCommitment : reactive .NewVariable [* Commitment ](),
89
77
LatestAttestedCommitment : reactive .NewVariable [* Commitment ](),
90
78
LatestProducedCommitment : reactive .NewVariable [* Commitment ](),
91
- ClaimedWeight : reactive .NewVariable [uint64 ](),
92
- AttestedWeight : reactive .NewVariable [uint64 ](),
93
- VerifiedWeight : reactive .NewVariable [uint64 ](),
94
79
WarpSyncMode : reactive .NewVariable [bool ]().Init (true ),
95
80
LatestSyncedSlot : reactive .NewVariable [iotago.SlotIndex ](),
96
81
OutOfSyncThreshold : reactive .NewVariable [iotago.SlotIndex ](),
@@ -189,9 +174,6 @@ func (c *Chain) initLogger() (shutdown func()) {
189
174
c .LatestSyncedSlot .LogUpdates (c , log .LevelTrace , "LatestSyncedSlot" ),
190
175
c .OutOfSyncThreshold .LogUpdates (c , log .LevelTrace , "OutOfSyncThreshold" ),
191
176
c .ForkingPoint .LogUpdates (c , log .LevelTrace , "ForkingPoint" , (* Commitment ).LogName ),
192
- c .ClaimedWeight .LogUpdates (c , log .LevelTrace , "ClaimedWeight" ),
193
- c .AttestedWeight .LogUpdates (c , log .LevelTrace , "AttestedWeight" ),
194
- c .VerifiedWeight .LogUpdates (c , log .LevelTrace , "VerifiedWeight" ),
195
177
c .LatestCommitment .LogUpdates (c , log .LevelTrace , "LatestCommitment" , (* Commitment ).LogName ),
196
178
c .LatestAttestedCommitment .LogUpdates (c , log .LevelTrace , "LatestAttestedCommitment" , (* Commitment ).LogName ),
197
179
c .LatestProducedCommitment .LogUpdates (c , log .LevelDebug , "LatestProducedCommitment" , (* Commitment ).LogName ),
@@ -207,9 +189,6 @@ func (c *Chain) initLogger() (shutdown func()) {
207
189
// initDerivedProperties initializes the behavior of this chain by setting up the relations between its properties.
208
190
func (c * Chain ) initDerivedProperties () (shutdown func ()) {
209
191
return lo .Batch (
210
- c .deriveClaimedWeight (),
211
- c .deriveVerifiedWeight (),
212
- c .deriveLatestAttestedWeight (),
213
192
c .deriveWarpSyncMode (),
214
193
215
194
c .ForkingPoint .WithValue (c .deriveParentChain ),
@@ -231,39 +210,6 @@ func (c *Chain) deriveWarpSyncMode() func() {
231
210
}, c .LatestSyncedSlot , c .chains .LatestSeenSlot , c .OutOfSyncThreshold , c .WarpSyncMode .Get ()))
232
211
}
233
212
234
- // deriveClaimedWeight defines how a chain determines its claimed weight (by setting the cumulative weight of the
235
- // latest commitment).
236
- func (c * Chain ) deriveClaimedWeight () (shutdown func ()) {
237
- return c .ClaimedWeight .DeriveValueFrom (reactive .NewDerivedVariable (func (_ uint64 , latestCommitment * Commitment ) uint64 {
238
- if latestCommitment == nil {
239
- return 0
240
- }
241
-
242
- return latestCommitment .CumulativeWeight ()
243
- }, c .LatestCommitment ))
244
- }
245
-
246
- // deriveLatestAttestedWeight defines how a chain determines its attested weight (by inheriting the cumulative attested
247
- // weight of the latest attested commitment). It uses inheritance instead of simply setting the value as the cumulative
248
- // attested weight can change over time depending on the attestations that are received.
249
- func (c * Chain ) deriveLatestAttestedWeight () func () {
250
- return c .LatestAttestedCommitment .WithNonEmptyValue (func (latestAttestedCommitment * Commitment ) (shutdown func ()) {
251
- return c .AttestedWeight .InheritFrom (latestAttestedCommitment .CumulativeAttestedWeight )
252
- })
253
- }
254
-
255
- // deriveVerifiedWeight defines how a chain determines its verified weight (by setting the cumulative weight of the
256
- // latest produced commitment).
257
- func (c * Chain ) deriveVerifiedWeight () func () {
258
- return c .VerifiedWeight .DeriveValueFrom (reactive .NewDerivedVariable (func (_ uint64 , latestProducedCommitment * Commitment ) uint64 {
259
- if latestProducedCommitment == nil {
260
- return 0
261
- }
262
-
263
- return latestProducedCommitment .CumulativeWeight ()
264
- }, c .LatestProducedCommitment ))
265
- }
266
-
267
213
// deriveChildChains defines how a chain determines its ChildChains (by adding each child to the set).
268
214
func (c * Chain ) deriveChildChains (child * Chain ) func () {
269
215
c .ChildChains .Add (child )
@@ -353,21 +299,3 @@ func (c *Chain) dispatchBlockToSpawnedEngine(block *model.Block, src peer.ID) (d
353
299
354
300
return true
355
301
}
356
-
357
- // claimedWeight is a getter for the ClaimedWeight variable of this chain, which is internally used to be able to
358
- // "address" the variable across multiple chains in a generic way.
359
- func (c * Chain ) claimedWeight () reactive.Variable [uint64 ] {
360
- return c .ClaimedWeight
361
- }
362
-
363
- // verifiedWeight is a getter for the VerifiedWeight variable of this chain, which is internally used to be able to
364
- // "address" the variable across multiple chains in a generic way.
365
- func (c * Chain ) verifiedWeight () reactive.Variable [uint64 ] {
366
- return c .VerifiedWeight
367
- }
368
-
369
- // attestedWeight is a getter for the AttestedWeight variable of this chain, which is internally used to be able to
370
- // "address" the variable across multiple chains in a generic way.
371
- func (c * Chain ) attestedWeight () reactive.Variable [uint64 ] {
372
- return c .AttestedWeight
373
- }
0 commit comments