Skip to content

Commit

Permalink
context: return preBlock from (*Context).PreBlock()
Browse files Browse the repository at this point in the history
From the user's PoW PreBlock should be returned from this method, not
PreHeader, otherwise the behaviour is misleading and causes bugs.

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed Oct 30, 2024
1 parent ba32988 commit f25e7ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ func (c *Context[H]) MoreThanFNodesCommittedOrLost() bool {
return c.CountCommitted()+c.CountFailed() > c.F()
}

// PreBlock returns current PreBlock from context. May be nil in case if no
// PreBlock is constructed yet (even if PreHeader is already constructed).
// External changes in the PreBlock will be seen by dBFT.
func (c *Context[H]) PreBlock() PreBlock[H] {
return c.preHeader // without transactions
return c.preBlock
}

func (c *Context[H]) reset(view byte, ts uint64) {
Expand Down

0 comments on commit f25e7ce

Please sign in to comment.