aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-04-08 15:32:32 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-15 22:09:55 +0800
commit1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec (patch)
treea3a7ce90940fdf7e0eeb2003e9b078da50fc7904 /vendor/github.com/dexon-foundation
parent586574e39d8e7a057f0092bdb8374a130384a531 (diff)
downloadgo-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar
go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.gz
go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.bz2
go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.lz
go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.xz
go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.tar.zst
go-tangerine-1a2059fc4e00a34fb555dff1528d6a1e88e7a1ec.zip
vendor: sync to latest core
Diffstat (limited to 'vendor/github.com/dexon-foundation')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go1
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go7
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go6
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go13
4 files changed, 21 insertions, 6 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go
index 4e6f230dc..af0adf259 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/agreement-mgr.go
@@ -257,6 +257,7 @@ func (mgr *agreementMgr) processVote(v *types.Vote) (err error) {
}
if err = mgr.baModule.processVote(v); err == nil {
mgr.baModule.updateFilter(mgr.voteFilter)
+ mgr.voteFilter.AddVote(v)
}
return
}
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go
index fbd504d24..4a99d3dcc 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/configuration-chain.go
@@ -662,7 +662,7 @@ func (cc *configurationChain) untouchTSigHash(hash common.Hash) {
}
func (cc *configurationChain) runTSig(
- round uint64, hash common.Hash) (
+ round uint64, hash common.Hash, wait time.Duration) (
crypto.Signature, error) {
npks, _, _ := cc.getDKGInfo(round, false)
if npks == nil {
@@ -687,8 +687,7 @@ func (cc *configurationChain) runTSig(
}()
timeout := make(chan struct{}, 1)
go func() {
- // TODO(jimmy-dexon): make timeout configurable.
- time.Sleep(5 * time.Second)
+ time.Sleep(wait)
timeout <- struct{}{}
cc.tsigReady.Broadcast()
}()
@@ -714,7 +713,7 @@ func (cc *configurationChain) runTSig(
func (cc *configurationChain) runCRSTSig(
round uint64, crs common.Hash) ([]byte, error) {
- sig, err := cc.runTSig(round, crs)
+ sig, err := cc.runTSig(round, crs, cc.gov.Configuration(round).LambdaDKG*5)
cc.logger.Info("CRS",
"nodeID", cc.ID,
"round", round+1,
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 adaf51d62..ca7d10f2e 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go
@@ -1084,7 +1084,11 @@ func (con *Consensus) generateBlockRandomness(blocks []*types.Block) {
"proposer", psig.ProposerID,
"block", block)
con.network.BroadcastDKGPartialSignature(psig)
- sig, err := con.cfgModule.runTSig(block.Position.Round, block.Hash)
+ sig, err := con.cfgModule.runTSig(
+ block.Position.Round,
+ block.Hash,
+ 60*time.Minute,
+ )
if err != nil {
con.logger.Error("Failed to run Block Tsig",
"block", block,
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go
index a19902758..2fc18bb34 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/vote-filter.go
@@ -24,6 +24,7 @@ import (
// VoteFilter filters votes that are useless for now.
// To maximize performance, this structure is not thread-safe and will never be.
type VoteFilter struct {
+ Voted map[types.VoteHeader]struct{}
Height uint64
LockIter uint64
Period uint64
@@ -32,7 +33,9 @@ type VoteFilter struct {
// NewVoteFilter creates a new vote filter instance.
func NewVoteFilter() *VoteFilter {
- return &VoteFilter{}
+ return &VoteFilter{
+ Voted: make(map[types.VoteHeader]struct{}),
+ }
}
// Filter checks if the vote should be filtered out.
@@ -57,5 +60,13 @@ func (vf *VoteFilter) Filter(vote *types.Vote) bool {
vote.BlockHash == types.SkipBlockHash {
return true
}
+ if _, exist := vf.Voted[vote.VoteHeader]; exist {
+ return true
+ }
return false
}
+
+// AddVote to the filter so the same vote will be filtered.
+func (vf *VoteFilter) AddVote(vote *types.Vote) {
+ vf.Voted[vote.VoteHeader] = struct{}{}
+}