Skip to content

Commit

Permalink
removed the request from the pool if the check showed that the propos…
Browse files Browse the repository at this point in the history
…al is bad (hyperledger#4572)

Signed-off-by: Fedor Partanskiy <pfi79@mail.ru>

(cherry picked from commit 073b570)
Signed-off-by: Fedor Partanskiy <pfi79@mail.ru>
  • Loading branch information
pfi79 committed Dec 25, 2023
1 parent 8587ac9 commit 7729698
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions orderer/consensus/smartbft/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ func (c *BFTChain) pruneCommittedRequests(block *cb.Block) {
wg.Wait()
}

func (c *BFTChain) pruneBadRequests() {
c.consensus.Pool.Prune(func(req []byte) error {
_, err := c.consensus.Verifier.VerifyRequest(req)
return err
})
}

func (c *BFTChain) submit(env *cb.Envelope, configSeq uint64) error {
reqBytes, err := proto.Marshal(env)
if err != nil {
Expand Down Expand Up @@ -556,6 +563,7 @@ func (c *BFTChain) updateRuntimeConfig(block *cb.Block) types.Reconfig {
c.RuntimeConfig.Store(newRTC)
if protoutil.IsConfigBlock(block) {
c.Comm.Configure(c.Channel, newRTC.RemoteNodes)
c.pruneBadRequests()
}

membershipDidNotChange := reflect.DeepEqual(newRTC.Nodes, prevRTC.Nodes)
Expand Down

0 comments on commit 7729698

Please sign in to comment.