@@ -58,8 +58,8 @@ type Config[H Hash] struct {
5858 GetVerified func () []Transaction [H ]
5959 // VerifyPreBlock verifies if preBlock is valid.
6060 VerifyPreBlock func (b PreBlock [H ]) bool
61- // VerifyBlock verifies if block is valid.
62- VerifyBlock func (b Block [H ]) bool
61+ // VerifyBlock verifies if block is valid and optionally returns the hash of invalid transaction .
62+ VerifyBlock func (b Block [H ]) ( bool , H )
6363 // Broadcast should broadcast payload m to the consensus nodes.
6464 Broadcast func (m ConsensusPayload [H ])
6565 // ProcessBlock is called every time new preBlock is accepted.
@@ -86,7 +86,7 @@ type Config[H Hash] struct {
8686 // NewPrepareResponse is a constructor for payload.PrepareResponse.
8787 NewPrepareResponse func (preparationHash H ) PrepareResponse [H ]
8888 // NewChangeView is a constructor for payload.ChangeView.
89- NewChangeView func (newViewNumber byte , reason ChangeViewReason , timestamp uint64 ) ChangeView
89+ NewChangeView func (newViewNumber byte , reason ChangeViewReason , timestamp uint64 , rejectedHash ... H ) ChangeView
9090 // NewPreCommit is a constructor for payload.PreCommit.
9191 NewPreCommit func (data []byte ) PreCommit
9292 // NewCommit is a constructor for payload.Commit.
@@ -124,7 +124,7 @@ func defaultConfig[H Hash]() *Config[H] {
124124 StopTxFlow : func () {},
125125 GetTx : func (H ) Transaction [H ] { return nil },
126126 GetVerified : func () []Transaction [H ] { return make ([]Transaction [H ], 0 ) },
127- VerifyBlock : func (Block [H ]) bool { return true },
127+ VerifyBlock : func (Block [H ]) ( bool , H ) { return true , * new ( H ) },
128128 Broadcast : func (ConsensusPayload [H ]) {},
129129 ProcessBlock : func (Block [H ]) error { return nil },
130130 GetBlock : func (H ) Block [H ] { return nil },
@@ -317,7 +317,7 @@ func WithVerifyPreBlock[H Hash](f func(b PreBlock[H]) bool) func(config *Config[
317317}
318318
319319// WithVerifyBlock sets VerifyBlock.
320- func WithVerifyBlock [H Hash ](f func (b Block [H ]) bool ) func (config * Config [H ]) {
320+ func WithVerifyBlock [H Hash ](f func (b Block [H ]) ( bool , H ) ) func (config * Config [H ]) {
321321 return func (cfg * Config [H ]) {
322322 cfg .VerifyBlock = f
323323 }
@@ -402,7 +402,7 @@ func WithNewPrepareResponse[H Hash](f func(preparationHash H) PrepareResponse[H]
402402}
403403
404404// WithNewChangeView sets NewChangeView.
405- func WithNewChangeView [H Hash ](f func (newViewNumber byte , reason ChangeViewReason , ts uint64 ) ChangeView ) func (config * Config [H ]) {
405+ func WithNewChangeView [H Hash ](f func (newViewNumber byte , reason ChangeViewReason , ts uint64 , rejectedHash ... H ) ChangeView ) func (config * Config [H ]) {
406406 return func (cfg * Config [H ]) {
407407 cfg .NewChangeView = f
408408 }
0 commit comments