OSDN Git Service

add get vote result (#345)
[bytom/vapor.git] / protocol / bbft.go
index 888ce99..a6a6deb 100644 (file)
@@ -133,7 +133,7 @@ func (c *Chain) validateSign(block *types.Block) error {
                        cachekey := signCacheKey(blockHash.String(), pubKey)
                        if signature, ok := c.signatureCache.Get(cachekey); ok {
                                block.Set(node.Order, signature.([]byte))
-                               c.eventDispatcher.Post(event.BlockSignatureEvent{BlockHash: blockHash, Signature: signature.([]byte), XPub: []byte(pubKey)})
+                               c.eventDispatcher.Post(event.BlockSignatureEvent{BlockHash: blockHash, Signature: signature.([]byte), XPub: node.XPub[:]})
                                c.signatureCache.Remove(cachekey)
                        } else {
                                continue
@@ -168,7 +168,7 @@ func (c *Chain) ProcessBlockSignature(signature, xPub []byte, blockHash *bc.Hash
        // save the signature if the block is not exist
        if blockHeader == nil {
                var xPubKey chainkd.XPub
-               copy(xPub[:], xPub[:])
+               copy(xPubKey[:], xPub[:])
                if !xPubKey.Verify(blockHash.Bytes(), signature) {
                        return errInvalidSignature
                }