aboutsummaryrefslogtreecommitdiffstats
path: root/core/configuration-chain.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-17 17:14:42 +0800
committerGitHub <noreply@github.com>2018-10-17 17:14:42 +0800
commit21ab1ac7be6e88b88f75b10eb83d409bc0322254 (patch)
tree839134b4cf502b55da5b1707d1279bf58eb368a4 /core/configuration-chain.go
parent6f1df59f8b32d30d5a7a0d9449f2dca698a8ac39 (diff)
downloaddexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.tar
dexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.tar.gz
dexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.tar.bz2
dexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.tar.lz
dexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.tar.xz
dexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.tar.zst
dexon-consensus-21ab1ac7be6e88b88f75b10eb83d409bc0322254.zip
core: Rebroadcast agreement and randomness result. (#218)
Diffstat (limited to 'core/configuration-chain.go')
-rw-r--r--core/configuration-chain.go30
1 files changed, 20 insertions, 10 deletions
diff --git a/core/configuration-chain.go b/core/configuration-chain.go
index 5cedcf4..c40d788 100644
--- a/core/configuration-chain.go
+++ b/core/configuration-chain.go
@@ -39,16 +39,17 @@ var (
)
type configurationChain struct {
- ID types.NodeID
- recv dkgReceiver
- gov Governance
- dkg *dkgProtocol
- dkgLock sync.RWMutex
- dkgSigner map[uint64]*dkgShareSecret
- gpk map[uint64]*DKGGroupPublicKey
- dkgResult sync.RWMutex
- tsig map[common.Hash]*tsigProtocol
- tsigReady *sync.Cond
+ ID types.NodeID
+ recv dkgReceiver
+ gov Governance
+ dkg *dkgProtocol
+ dkgLock sync.RWMutex
+ dkgSigner map[uint64]*dkgShareSecret
+ gpk map[uint64]*DKGGroupPublicKey
+ dkgResult sync.RWMutex
+ tsig map[common.Hash]*tsigProtocol
+ tsigTouched map[common.Hash]struct{}
+ tsigReady *sync.Cond
// TODO(jimmy-dexon): add timeout to pending psig.
pendingPsig map[common.Hash][]*types.DKGPartialSignature
prevHash common.Hash
@@ -182,6 +183,14 @@ func (cc *configurationChain) preparePartialSignature(
}, nil
}
+func (cc *configurationChain) touchTSigHash(hash common.Hash) (first bool) {
+ cc.tsigReady.L.Lock()
+ defer cc.tsigReady.L.Unlock()
+ _, exist := cc.tsigTouched[hash]
+ cc.tsigTouched[hash] = struct{}{}
+ return !exist
+}
+
func (cc *configurationChain) runTSig(
round uint64, hash common.Hash) (
crypto.Signature, error) {
@@ -218,6 +227,7 @@ func (cc *configurationChain) runTSig(
cc.tsigReady.Wait()
}
delete(cc.tsig, hash)
+ delete(cc.tsigTouched, hash)
if err != nil {
return crypto.Signature{}, err
}