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 <shaleva.ann@nspcc.ru>
  • Loading branch information
AnnaShaleva committed Oct 30, 2024
1 parent ba32988 commit 1bb7e0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Bugs fixed:
* context-bound PreBlock and PreHeader are not reset properly (#127)
* PreHeader is constructed instead of PreBlock to create PreCommit message (#128)
* enable anti-MEV extension with respect to the current block index (#132)
* (*Context).PreBlock() method returns PreHeader instead of PreBlock (#133)

## [0.3.0] (01 August 2024)

Expand Down
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 1bb7e0d

Please sign in to comment.