diff --git a/snow/consensus/snowball/tree.go b/snow/consensus/snowball/tree.go index 50bb8a53fb25..18380f004b4b 100644 --- a/snow/consensus/snowball/tree.go +++ b/snow/consensus/snowball/tree.go @@ -412,11 +412,13 @@ func (u *unaryNode) RecordPoll(votes ids.Bag, reset bool) node { // u.commonPrefix and u.child.DecidedPrefix() would always result in // the same set being returned. - // If I'm now decided, return my child + newChild := u.child.RecordPoll(votes, u.shouldReset) if u.Finalized() { - return u.child.RecordPoll(votes, u.shouldReset) + // If I'm now decided, return my child + return newChild } - u.child = u.child.RecordPoll(votes, u.shouldReset) + u.child = newChild + // The child's preference may have changed u.preference = u.child.Preference() } @@ -519,12 +521,12 @@ func (b *binaryNode) RecordPoll(votes ids.Bag, reset bool) node { filteredVotes := prunedVotes.Filter( b.bit+1, child.DecidedPrefix(), b.preferences[bit]) + newChild := child.RecordPoll(filteredVotes, b.shouldReset[bit]) if b.snowball.Finalized() { // If we are decided here, that means we must have decided due // to this poll. Therefore, we must have decided on bit. - return child.RecordPoll(filteredVotes, b.shouldReset[bit]) + return newChild } - newChild := child.RecordPoll(filteredVotes, b.shouldReset[bit]) b.children[bit] = newChild b.preferences[bit] = newChild.Preference() } diff --git a/snow/consensus/snowman/snowman_block.go b/snow/consensus/snowman/snowman_block.go index 3187d0a0c0ff..a6e75a0120c8 100644 --- a/snow/consensus/snowman/snowman_block.go +++ b/snow/consensus/snowman/snowman_block.go @@ -21,7 +21,7 @@ type snowmanBlock struct { // less than Alpha votes shouldFalter bool - // sb is the snowball instance used to decided which child is the canonical + // sb is the snowball instance used to decide which child is the canonical // child of this block. If this node has not had a child issued under it, // this value will be nil sb snowball.Consensus