aboutsummaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-04-06 17:26:10 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:59 +0800
commit497d7a31d284682eb0214d75f04a366b44cc9c33 (patch)
tree84f12fb99c03160e0a2a2cd3d54ea62a6c7935a5 /vendor
parenta549601f95ae642f66612ac4566c4dcbeb8e815f (diff)
downloaddexon-497d7a31d284682eb0214d75f04a366b44cc9c33.tar
dexon-497d7a31d284682eb0214d75f04a366b44cc9c33.tar.gz
dexon-497d7a31d284682eb0214d75f04a366b44cc9c33.tar.bz2
dexon-497d7a31d284682eb0214d75f04a366b44cc9c33.tar.lz
dexon-497d7a31d284682eb0214d75f04a366b44cc9c33.tar.xz
dexon-497d7a31d284682eb0214d75f04a366b44cc9c33.tar.zst
dexon-497d7a31d284682eb0214d75f04a366b44cc9c33.zip
vendor: sync to latest core
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go7
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/crypto/dkg/dkg.go25
-rw-r--r--vendor/vendor.json44
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"
},