diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-04-09 16:47:03 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:33:22 +0800 |
commit | 37c0142d0d3eaef16739386bade7d42f3a58fe9b (patch) | |
tree | c41924e9f3976f4163b4299bbec28ffd10a8b29b | |
parent | 6f858a9810ecd0e9764c1d0b9fb7976f9eff7737 (diff) | |
download | dexon-37c0142d0d3eaef16739386bade7d42f3a58fe9b.tar.gz dexon-37c0142d0d3eaef16739386bade7d42f3a58fe9b.tar.zst dexon-37c0142d0d3eaef16739386bade7d42f3a58fe9b.zip |
vendor: sync to latest core
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go | 22 | ||||
-rw-r--r-- | vendor/vendor.json | 42 |
2 files changed, 38 insertions, 26 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go index f1a383bb3..966c70aaa 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -264,8 +264,9 @@ func (recv *consensusBAReceiver) ConfirmBlock( } IDs = append(IDs, ID) psigs = append(psigs, vote.PartialSignature) + } else { + voteList = append(voteList, *vote) } - voteList = append(voteList, *vote) } if block.Position.Round >= DKGDelayRound { rand, err := cryptoDKG.RecoverSignature(psigs, IDs) @@ -289,7 +290,9 @@ func (recv *consensusBAReceiver) ConfirmBlock( Randomness: block.Randomness, } // touchAgreementResult does not support concurrent access. - recv.consensus.msgChan <- (*selfAgreementResult)(result) + go func() { + recv.consensus.priorityMsgChan <- (*selfAgreementResult)(result) + }() recv.consensus.logger.Debug("Broadcast AgreementResult", "result", result) recv.consensus.network.BroadcastAgreementResult(result) @@ -518,6 +521,7 @@ type Consensus struct { logger common.Logger resetDeliveryGuardTicker chan struct{} msgChan chan interface{} + priorityMsgChan chan interface{} waitGroup sync.WaitGroup processBlockChan chan *types.Block @@ -679,6 +683,7 @@ func newConsensusForRound( logger: logger, resetDeliveryGuardTicker: make(chan struct{}), msgChan: make(chan interface{}, 1024), + priorityMsgChan: make(chan interface{}, 1024), processBlockChan: make(chan *types.Block, 1024), } con.ctx, con.ctxCancel = context.WithCancel(context.Background()) @@ -1223,9 +1228,16 @@ MessageLoop: } var msg interface{} select { - case msg = <-con.msgChan: - case <-con.ctx.Done(): - return + case msg = <-con.priorityMsgChan: + default: + } + if msg == nil { + select { + case msg = <-con.msgChan: + case msg = <-con.priorityMsgChan: + case <-con.ctx.Done(): + return + } } switch val := msg.(type) { case *selfAgreementResult: diff --git a/vendor/vendor.json b/vendor/vendor.json index 3423e04ea..bc11c9398 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -141,16 +141,16 @@ { "checksumSHA1": "In6vBHYUsX7DUIGiFN2hQggBgvI=", "path": "github.com/dexon-foundation/dexon-consensus/common", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { - "checksumSHA1": "ccoiRDJLMikegFi9CPyJtrmJa3c=", + "checksumSHA1": "+omcW5A0/pD0ScXpN2SWIP6RC7A=", "path": "github.com/dexon-foundation/dexon-consensus/core", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, @@ -165,64 +165,64 @@ { "checksumSHA1": "tQSbYCu5P00lUhKsx3IbBZCuSLY=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "m5lUT04qSHKtFukvxjnFX5Jo2hI=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "BhLKK8RveoLaeXc9UyUKMwQqchU=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "hj/KetWUHp+1CX+50V0QnCthfWc=", "path": "github.com/dexon-foundation/dexon-consensus/core/db", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "B+2VHG7l1JXbxjuL52d+yp54K1g=", "path": "github.com/dexon-foundation/dexon-consensus/core/syncer", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "zIgCdN4FJiAuPGMhB+/9YGK/Wgk=", "path": "github.com/dexon-foundation/dexon-consensus/core/types", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "lbG7yqVgzo2CV/CQPYjG78xp5jg=", "path": "github.com/dexon-foundation/dexon-consensus/core/types/dkg", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "1VsJIshz0loXnGwCtrMM8SuIo6Y=", "path": "github.com/dexon-foundation/dexon-consensus/core/utils", - "revision": "a10fb3e2cf82782da2d8d69c2b0a6209c11d82b8", - "revisionTime": "2019-04-09T03:17:03Z", + "revision": "f5a753891357ce76308578234ed9edd15bf81f23", + "revisionTime": "2019-04-09T08:31:02Z", "version": "single-chain", "versionExact": "single-chain" }, |