From a989600cdbd46ba50d9047d08b5268d598c5bba4 Mon Sep 17 00:00:00 2001 From: muscle_boy Date: Thu, 6 Jun 2019 10:10:11 +0800 Subject: [PATCH] add broadcast block signature (#139) --- protocol/bbft.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/protocol/bbft.go b/protocol/bbft.go index 40b27300..4fdb6074 100644 --- a/protocol/bbft.go +++ b/protocol/bbft.go @@ -11,6 +11,7 @@ import ( "github.com/vapor/protocol/bc" "github.com/vapor/protocol/bc/types" "github.com/vapor/protocol/state" + "github.com/vapor/event" ) const ( @@ -65,7 +66,11 @@ func (c *Chain) ProcessBlockSignature(signature []byte, xPub [64]byte, blockHash return err } - if consensusNode.XPub.Verify(blockHash.Bytes(), signature) { + if exist, err := blockNode.BlockWitness.Test(uint32(consensusNode.Order)); err != nil && exist { + return nil + } + + if !consensusNode.XPub.Verify(blockHash.Bytes(), signature) { return errInvalidSignature } @@ -90,7 +95,8 @@ func (c *Chain) ProcessBlockSignature(signature []byte, xPub [64]byte, blockHash c.bestIrreversibleNode = bestIrreversibleNode } - return nil + + return c.eventDispatcher.Post(event.BlockSignatureEvent{BlockHash: *blockHash, Signature: signature, XPub: xPub}) } // validateSign verify the signatures of block, and return the number of correct signature -- 2.11.0