log "github.com/sirupsen/logrus"
"github.com/vapor/config"
+ "github.com/vapor/crypto/ed25519/chainkd"
"github.com/vapor/errors"
"github.com/vapor/event"
"github.com/vapor/protocol/bc"
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: node.XPub[:]})
c.signatureCache.Remove(cachekey)
} else {
continue
// save the signature if the block is not exist
if blockHeader == nil {
+ var xPubKey chainkd.XPub
+ copy(xPubKey[:], xPub[:])
+ if !xPubKey.Verify(blockHash.Bytes(), signature) {
+ return errInvalidSignature
+ }
+
cacheKey := signCacheKey(blockHash.String(), xpubStr)
c.signatureCache.Add(cacheKey, signature)
return nil