OSDN Git Service

sync for late node
authorshenao78 <shenao.78@163.com>
Wed, 1 Apr 2020 09:57:05 +0000 (17:57 +0800)
committershenao78 <shenao.78@163.com>
Wed, 1 Apr 2020 09:57:05 +0000 (17:57 +0800)
protocol/protocol.go

index 18ecc7a..fd8879a 100644 (file)
@@ -228,7 +228,7 @@ func (c *Chain) syncProtocolStatus(subProtocol SubProtocol) error {
        }
 
        protocolHeight, protocolHash, err := subProtocol.ChainStatus()
-       if err != ErrNotInitSubProtocolChainStatus {
+       if err == ErrNotInitSubProtocolChainStatus {
                startHash, err := c.store.GetMainChainHash(subProtocol.StartHeight())
                if err != nil {
                        return errors.Wrap(err, subProtocol.Name(), "can't get block hash by height")
@@ -239,6 +239,8 @@ func (c *Chain) syncProtocolStatus(subProtocol SubProtocol) error {
                }
 
                protocolHeight, protocolHash = subProtocol.StartHeight(), startHash
+       } else {
+               return errors.Wrap(err, subProtocol.Name(), "can't get chain status")
        }
 
        if *protocolHash == c.bestBlockHeader.Hash() {