Skip to content

Commit

Permalink
Fix node initialization in snowman test (#3398)
Browse files Browse the repository at this point in the history
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
  • Loading branch information
yacovm committed Sep 18, 2024
1 parent d660979 commit c18d475
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions snow/consensus/snowman/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,11 @@ func (n *Network) AddNode(t testing.TB, sm Consensus) error {
}

n.shuffleColors()
deps := map[ids.ID]ids.ID{}
for _, blk := range n.colors {
myDep, found := deps[blk.ParentV]
if !found {
myDep = blk.Parent()
}
myBlock := &snowmantest.Block{
Decidable: snowtest.Decidable{
IDV: blk.ID(),
Status: blk.Status,
},
ParentV: myDep,
HeightV: blk.Height(),
VerifyV: blk.Verify(context.Background()),
BytesV: blk.Bytes(),
}
if err := sm.Add(myBlock); err != nil {
copiedBlk := *blk
if err := sm.Add(&copiedBlk); err != nil {
return err
}
deps[myBlock.ID()] = myDep
}
n.nodes = append(n.nodes, sm)
n.running = append(n.running, sm)
Expand Down

0 comments on commit c18d475

Please sign in to comment.