Skip to content

Commit

Permalink
Fix: fixed missing variable initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hmoog committed Mar 22, 2024
1 parent e6b3b72 commit 5a3842d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions pkg/protocol/engine/blocks/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func NewBlock(modelBlock *model.Block) *Block {
solid: reactive.NewVariable[bool](),
invalid: reactive.NewVariable[bool](),
booked: reactive.NewVariable[bool](),
preAccepted: reactive.NewVariable[bool](),
accepted: reactive.NewVariable[bool](),
weightPropagated: reactive.NewVariable[bool](),
notarized: reactive.NewEvent(),
Expand All @@ -106,22 +107,17 @@ func NewRootBlock(blockID iotago.BlockID, commitmentID iotago.CommitmentID, issu
commitmentID: commitmentID,
issuingTime: issuingTime,
},
solid: reactive.NewVariable[bool](),
solid: reactive.NewVariable[bool]().Init(true),
invalid: reactive.NewVariable[bool](),
booked: reactive.NewVariable[bool](),
preAccepted: reactive.NewVariable[bool](),
accepted: reactive.NewVariable[bool](),
weightPropagated: reactive.NewVariable[bool](),
booked: reactive.NewVariable[bool]().Init(true),
preAccepted: reactive.NewVariable[bool]().Init(true),
accepted: reactive.NewVariable[bool]().Init(true),
weightPropagated: reactive.NewVariable[bool]().Init(true),
notarized: reactive.NewEvent(),
scheduled: true,
}

// This should be true since we commit and evict on acceptance.
b.solid.Set(true)
b.booked.Set(true)
b.weightPropagated.Set(true)
b.notarized.Set(true)
b.accepted.Set(true)
b.notarized.Trigger()

return b
}
Expand All @@ -138,6 +134,7 @@ func NewMissingBlock(blockID iotago.BlockID) *Block {
solid: reactive.NewVariable[bool](),
invalid: reactive.NewVariable[bool](),
booked: reactive.NewVariable[bool](),
preAccepted: reactive.NewVariable[bool](),
accepted: reactive.NewVariable[bool](),
weightPropagated: reactive.NewVariable[bool](),
notarized: reactive.NewEvent(),
Expand Down

0 comments on commit 5a3842d

Please sign in to comment.