• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision2499362b4394abe62c5aaf6198c05ef3c293d46a (tree)
Time2019-07-15 12:15:34
AuthorPaladz <yzhu101@uott...>
CommiterGitHub

Log Message

Merge branch 'master' into filter_t

Change Summary

Incremental Difference

--- a/netsync/chainmgr/block_process.go
+++ b/netsync/chainmgr/block_process.go
@@ -5,10 +5,13 @@ import (
55
66 log "github.com/sirupsen/logrus"
77
8+ "github.com/vapor/errors"
89 "github.com/vapor/netsync/peers"
910 "github.com/vapor/p2p/security"
1011 )
1112
13+var errOrphanBlock = errors.New("fast sync inserting orphan block")
14+
1215 type BlockProcessor interface {
1316 process(chan struct{}, chan struct{}, *sync.WaitGroup)
1417 }
@@ -29,7 +32,12 @@ func newBlockProcessor(chain Chain, storage Storage, peers *peers.PeerSet) *bloc
2932
3033 func (bp *blockProcessor) insert(blockStorage *blockStorage) error {
3134 isOrphan, err := bp.chain.ProcessBlock(blockStorage.block)
32- if err != nil || isOrphan {
35+ if isOrphan {
36+ bp.peers.ProcessIllegal(blockStorage.peerID, security.LevelMsgIllegal, errOrphanBlock.Error())
37+ return errOrphanBlock
38+ }
39+
40+ if err != nil {
3341 bp.peers.ProcessIllegal(blockStorage.peerID, security.LevelMsgIllegal, err.Error())
3442 }
3543 return err
Show on old repository browser