diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-04-12 11:35:37 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-12 11:35:37 +0800 |
commit | 24c0cecbbf7ba84754ccc02d37c9540ce317976c (patch) | |
tree | 81031ec19affa0a0b962af627301963b077ea194 /core/syncer | |
parent | 1107fedc61b1b042216948d9fea78e7747f7599f (diff) | |
download | dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.tar dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.tar.gz dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.tar.bz2 dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.tar.lz dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.tar.xz dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.tar.zst dexon-consensus-24c0cecbbf7ba84754ccc02d37c9540ce317976c.zip |
core: add report bad peer interface to network (#559)
Diffstat (limited to 'core/syncer')
-rw-r--r-- | core/syncer/consensus.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/syncer/consensus.go b/core/syncer/consensus.go index 7db836a..496c0f9 100644 --- a/core/syncer/consensus.go +++ b/core/syncer/consensus.go @@ -80,7 +80,7 @@ type Consensus struct { syncedSkipNext bool dummyCancel context.CancelFunc dummyFinished <-chan struct{} - dummyMsgBuffer []interface{} + dummyMsgBuffer []types.Msg initChainTipHeight uint64 } @@ -297,7 +297,7 @@ func (con *Consensus) ForceSync(lastPos types.Position, skip bool) { if con.dummyCancel == nil { con.dummyCancel, con.dummyFinished = utils.LaunchDummyReceiver( context.Background(), con.network.ReceiveChan(), - func(msg interface{}) { + func(msg types.Msg) { con.dummyMsgBuffer = append(con.dummyMsgBuffer, msg) }) } @@ -448,7 +448,7 @@ func (con *Consensus) stopBuffering() { // need to launch a dummy receiver right away. con.dummyCancel, con.dummyFinished = utils.LaunchDummyReceiver( context.Background(), con.network.ReceiveChan(), - func(msg interface{}) { + func(msg types.Msg) { con.dummyMsgBuffer = append(con.dummyMsgBuffer, msg) }) // Stop agreements. @@ -512,7 +512,7 @@ func (con *Consensus) startNetwork() { for { select { case val := <-con.network.ReceiveChan(): - switch v := val.(type) { + switch v := val.Payload.(type) { case *types.Block: case *types.AgreementResult: // Avoid byzantine nodes attack by broadcasting older @@ -524,7 +524,7 @@ func (con *Consensus) startNetwork() { default: continue loop } - con.agreementModule.inputChan <- val + con.agreementModule.inputChan <- val.Payload case <-con.ctx.Done(): break loop } |