diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-04-06 17:26:10 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-15 22:09:55 +0800 |
commit | 2b6c8c733a52f686c7f418bb5218f53aa8c19a8d (patch) | |
tree | f91d9dff2a6673b17d656b308604765702f73c76 | |
parent | bd199cbed939f7cb9e14b501d520f762a2e82fff (diff) | |
download | go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.tar go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.tar.gz go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.tar.bz2 go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.tar.lz go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.tar.xz go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.tar.zst go-tangerine-2b6c8c733a52f686c7f418bb5218f53aa8c19a8d.zip |
vendor: sync to latest core
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go | 7 | ||||
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go | 25 | ||||
-rw-r--r-- | vendor/vendor.json | 44 |
3 files changed, 44 insertions, 32 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 e657c6449..adaf51d62 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -57,6 +57,8 @@ var ( "cannot verify block randomness") ) +type selfAgreementResult types.AgreementResult + // consensusBAReceiver implements agreementReceiver. type consensusBAReceiver struct { consensus *Consensus @@ -286,7 +288,8 @@ func (recv *consensusBAReceiver) ConfirmBlock( IsEmptyBlock: isEmptyBlockConfirmed, Randomness: block.Randomness, } - recv.consensus.baMgr.touchAgreementResult(result) + // touchAgreementResult does not support concurrent access. + recv.consensus.msgChan <- (*selfAgreementResult)(result) recv.consensus.logger.Debug("Broadcast AgreementResult", "result", result) recv.consensus.network.BroadcastAgreementResult(result) @@ -1217,6 +1220,8 @@ MessageLoop: return } switch val := msg.(type) { + case *selfAgreementResult: + con.baMgr.touchAgreementResult((*types.AgreementResult)(val)) case *types.Block: if ch, exist := func() (chan<- *types.Block, bool) { con.lock.RLock() diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go index b89ad100d..ab43f5130 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go @@ -450,11 +450,10 @@ func (prvs *PrivateKeyShares) Share(ID ID) (*PrivateKey, bool) { // NewEmptyPublicKeyShares creates an empty public key shares. func NewEmptyPublicKeyShares() *PublicKeyShares { - cache := &publicKeySharesCache{ - index: make(map[ID]int), - } pubShares := &PublicKeyShares{} - pubShares.cache.Store(cache) + pubShares.cache.Store(&publicKeySharesCache{ + index: make(map[ID]int), + }) return pubShares } @@ -481,9 +480,9 @@ func (pubs *PublicKeyShares) Share(ID ID) (*PublicKey, error) { } // AddShare adds a share. -func (pubs *PublicKeyShares) AddShare(ID ID, share *PublicKey) error { +func (pubs *PublicKeyShares) AddShare(shareID ID, share *PublicKey) error { cache := pubs.cache.Load().(*publicKeySharesCache) - if idx, exist := cache.index[ID]; exist { + if idx, exist := cache.index[shareID]; exist { if !share.publicKey.IsEqual(&cache.share[idx].publicKey) { return ErrDuplicatedShare } @@ -492,9 +491,17 @@ func (pubs *PublicKeyShares) AddShare(ID ID, share *PublicKey) error { pubs.lock.Lock() defer pubs.lock.Unlock() cache = pubs.cache.Load().(*publicKeySharesCache) - cache.index[ID] = len(cache.share) - cache.share = append(cache.share, *share) - pubs.cache.Store(cache) + newCache := &publicKeySharesCache{ + index: make(map[ID]int, len(cache.index)+1), + share: make([]PublicKey, len(cache.share), len(cache.share)+1), + } + for k, v := range cache.index { + newCache.index[k] = v + } + copy(newCache.share, cache.share) + newCache.index[shareID] = len(newCache.share) + newCache.share = append(newCache.share, *share) + pubs.cache.Store(newCache) return nil } diff --git a/vendor/vendor.json b/vendor/vendor.json index c83f22117..1b9700655 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -141,16 +141,16 @@ { "checksumSHA1": "In6vBHYUsX7DUIGiFN2hQggBgvI=", "path": "github.com/dexon-foundation/dexon-consensus/common", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { - "checksumSHA1": "IlhmhtgzSWYb1GTPVpYXHUMkSwM=", + "checksumSHA1": "RYHOTUhiRTYj3z6lXRP5Z1BHbso=", "path": "github.com/dexon-foundation/dexon-consensus/core", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, @@ -165,64 +165,64 @@ { "checksumSHA1": "tQSbYCu5P00lUhKsx3IbBZCuSLY=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { - "checksumSHA1": "mayhQ9KxdXeuzyssXiG5yW4ynGU=", + "checksumSHA1": "m5lUT04qSHKtFukvxjnFX5Jo2hI=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "BhLKK8RveoLaeXc9UyUKMwQqchU=", "path": "github.com/dexon-foundation/dexon-consensus/core/crypto/ecdsa", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "hj/KetWUHp+1CX+50V0QnCthfWc=", "path": "github.com/dexon-foundation/dexon-consensus/core/db", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "DILLD61kp1c3JZnyLZK84mMK9Jw=", "path": "github.com/dexon-foundation/dexon-consensus/core/syncer", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "zIgCdN4FJiAuPGMhB+/9YGK/Wgk=", "path": "github.com/dexon-foundation/dexon-consensus/core/types", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "lbG7yqVgzo2CV/CQPYjG78xp5jg=", "path": "github.com/dexon-foundation/dexon-consensus/core/types/dkg", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, { "checksumSHA1": "YooeNHTYxH05Ky5vnoyZsQR4/08=", "path": "github.com/dexon-foundation/dexon-consensus/core/utils", - "revision": "d433231363d622acb26f8fa9b072470c179dbc62", - "revisionTime": "2019-04-04T14:16:31Z", + "revision": "99e3dfee0eb2ffbb4fb0afb8e65664a7c9d91bcd", + "revisionTime": "2019-04-06T09:04:11Z", "version": "single-chain", "versionExact": "single-chain" }, |