@@ -35,18 +35,6 @@ type Chain struct {
35
35
// corresponding blocks in the Engine.
36
36
LatestProducedCommitment reactive.Variable [* Commitment ]
37
37
38
- // ClaimedWeight contains the claimed weight of this chain which is derived from the cumulative weight of the
39
- // LatestCommitment.
40
- ClaimedWeight reactive.Variable [uint64 ]
41
-
42
- // AttestedWeight contains the attested weight of this chain which is derived from the cumulative weight of all
43
- // attestations up to the LatestAttestedCommitment.
44
- AttestedWeight reactive.Variable [uint64 ]
45
-
46
- // VerifiedWeight contains the verified weight of this chain which is derived from the cumulative weight of the
47
- // latest verified commitment.
48
- VerifiedWeight reactive.Variable [uint64 ]
49
-
50
38
// WarpSyncMode contains a flag that indicates whether this chain is in warp sync mode.
51
39
WarpSyncMode reactive.Variable [bool ]
52
40
@@ -90,9 +78,6 @@ func newChain(chains *Chains) *Chain {
90
78
LatestCommitment : reactive .NewVariable [* Commitment ](),
91
79
LatestAttestedCommitment : reactive .NewVariable [* Commitment ](),
92
80
LatestProducedCommitment : reactive .NewVariable [* Commitment ](),
93
- ClaimedWeight : reactive .NewVariable [uint64 ](),
94
- AttestedWeight : reactive .NewVariable [uint64 ](),
95
- VerifiedWeight : reactive .NewVariable [uint64 ](),
96
81
WarpSyncMode : reactive .NewVariable [bool ]().Init (true ),
97
82
LatestSyncedSlot : reactive .NewVariable [iotago.SlotIndex ](),
98
83
OutOfSyncThreshold : reactive .NewVariable [iotago.SlotIndex ](),
@@ -191,9 +176,6 @@ func (c *Chain) initLogger() (shutdown func()) {
191
176
c .LatestSyncedSlot .LogUpdates (c , log .LevelTrace , "LatestSyncedSlot" ),
192
177
c .OutOfSyncThreshold .LogUpdates (c , log .LevelTrace , "OutOfSyncThreshold" ),
193
178
c .ForkingPoint .LogUpdates (c , log .LevelTrace , "ForkingPoint" , (* Commitment ).LogName ),
194
- c .ClaimedWeight .LogUpdates (c , log .LevelTrace , "ClaimedWeight" ),
195
- c .AttestedWeight .LogUpdates (c , log .LevelTrace , "AttestedWeight" ),
196
- c .VerifiedWeight .LogUpdates (c , log .LevelTrace , "VerifiedWeight" ),
197
179
c .LatestCommitment .LogUpdates (c , log .LevelTrace , "LatestCommitment" , (* Commitment ).LogName ),
198
180
c .LatestAttestedCommitment .LogUpdates (c , log .LevelTrace , "LatestAttestedCommitment" , (* Commitment ).LogName ),
199
181
c .LatestProducedCommitment .LogUpdates (c , log .LevelDebug , "LatestProducedCommitment" , (* Commitment ).LogName ),
@@ -209,9 +191,6 @@ func (c *Chain) initLogger() (shutdown func()) {
209
191
// initDerivedProperties initializes the behavior of this chain by setting up the relations between its properties.
210
192
func (c * Chain ) initDerivedProperties () (shutdown func ()) {
211
193
return lo .Batch (
212
- c .deriveClaimedWeight (),
213
- c .deriveVerifiedWeight (),
214
- c .deriveLatestAttestedWeight (),
215
194
c .deriveWarpSyncMode (),
216
195
217
196
c .ForkingPoint .WithValue (c .deriveParentChain ),
@@ -233,39 +212,6 @@ func (c *Chain) deriveWarpSyncMode() func() {
233
212
}, c .LatestSyncedSlot , c .chains .LatestSeenSlot , c .OutOfSyncThreshold , c .WarpSyncMode .Get ()))
234
213
}
235
214
236
- // deriveClaimedWeight defines how a chain determines its claimed weight (by setting the cumulative weight of the
237
- // latest commitment).
238
- func (c * Chain ) deriveClaimedWeight () (shutdown func ()) {
239
- return c .ClaimedWeight .DeriveValueFrom (reactive .NewDerivedVariable (func (_ uint64 , latestCommitment * Commitment ) uint64 {
240
- if latestCommitment == nil {
241
- return 0
242
- }
243
-
244
- return latestCommitment .CumulativeWeight ()
245
- }, c .LatestCommitment ))
246
- }
247
-
248
- // deriveLatestAttestedWeight defines how a chain determines its attested weight (by inheriting the cumulative attested
249
- // weight of the latest attested commitment). It uses inheritance instead of simply setting the value as the cumulative
250
- // attested weight can change over time depending on the attestations that are received.
251
- func (c * Chain ) deriveLatestAttestedWeight () func () {
252
- return c .LatestAttestedCommitment .WithNonEmptyValue (func (latestAttestedCommitment * Commitment ) (shutdown func ()) {
253
- return c .AttestedWeight .InheritFrom (latestAttestedCommitment .CumulativeAttestedWeight )
254
- })
255
- }
256
-
257
- // deriveVerifiedWeight defines how a chain determines its verified weight (by setting the cumulative weight of the
258
- // latest produced commitment).
259
- func (c * Chain ) deriveVerifiedWeight () func () {
260
- return c .VerifiedWeight .DeriveValueFrom (reactive .NewDerivedVariable (func (_ uint64 , latestProducedCommitment * Commitment ) uint64 {
261
- if latestProducedCommitment == nil {
262
- return 0
263
- }
264
-
265
- return latestProducedCommitment .CumulativeWeight ()
266
- }, c .LatestProducedCommitment ))
267
- }
268
-
269
215
// deriveChildChains defines how a chain determines its ChildChains (by adding each child to the set).
270
216
func (c * Chain ) deriveChildChains (child * Chain ) func () {
271
217
c .ChildChains .Add (child )
@@ -356,24 +302,6 @@ func (c *Chain) dispatchBlockToSpawnedEngine(block *model.Block, src peer.ID) (d
356
302
return true
357
303
}
358
304
359
- // claimedWeight is a getter for the ClaimedWeight variable of this chain, which is internally used to be able to
360
- // "address" the variable across multiple chains in a generic way.
361
- func (c * Chain ) claimedWeight () reactive.Variable [uint64 ] {
362
- return c .ClaimedWeight
363
- }
364
-
365
- // verifiedWeight is a getter for the VerifiedWeight variable of this chain, which is internally used to be able to
366
- // "address" the variable across multiple chains in a generic way.
367
- func (c * Chain ) verifiedWeight () reactive.Variable [uint64 ] {
368
- return c .VerifiedWeight
369
- }
370
-
371
- // attestedWeight is a getter for the AttestedWeight variable of this chain, which is internally used to be able to
372
- // "address" the variable across multiple chains in a generic way.
373
- func (c * Chain ) attestedWeight () reactive.Variable [uint64 ] {
374
- return c .AttestedWeight
375
- }
376
-
377
305
// winsTieBreak returns true if this chain wins the tie-break against the other chain (by comparing the IDs of the
378
306
// commitments where both chains diverged), which is only used when two chains have exactly the same weight.
379
307
func (c * Chain ) winsTieBreak (other * Chain ) bool {
0 commit comments