OSDN Git Service

fix_auth_cached_msg (#2034)
authorPoseidon <shenao.78@163.com>
Thu, 15 Jul 2021 06:18:14 +0000 (14:18 +0800)
committerGitHub <noreply@github.com>
Thu, 15 Jul 2021 06:18:14 +0000 (14:18 +0800)
Co-authored-by: Paladz <yzhu101@uottawa.ca>
protocol/casper/auth_verification.go

index ce144b2..668a7dd 100644 (file)
@@ -158,11 +158,12 @@ func (c *Casper) authCachedMsg(msg *ValidCasperSignMsg, msgKey string) error {
                return errors.Wrap(err, "get source checkpoint")
        }
 
-       target, err := c.store.GetCheckpoint(&msg.TargetHash)
-       if err != nil {
-               return errors.Wrap(err, "get target checkpoint")
+       targetNode := c.tree.nodeByHash(msg.TargetHash)
+       if targetNode == nil {
+               return errors.New("get target checkpoint")
        }
 
+       target := targetNode.Checkpoint
        v, err := convertVerification(source, target, msg)
        if err != nil {
                return errors.Wrap(err, "authVerificationLoop fail on newVerification")