aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-02-27 10:41:01 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:22 +0800
commit2b2396b6bce0f21b515ac2d38556f6dca08b1770 (patch)
tree60d6c93689b54534ecc88bd1491bd82fa372b541 /core
parentedb1273cb08d56df41b30b1f2f2e113f9b4296e4 (diff)
downloadgo-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.tar
go-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.tar.gz
go-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.tar.bz2
go-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.tar.lz
go-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.tar.xz
go-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.tar.zst
go-tangerine-2b2396b6bce0f21b515ac2d38556f6dca08b1770.zip
core: sync to latest core (#214)
* vendor: sync to latest core * fix for single chain
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go2
-rw-r--r--core/governance.go15
-rw-r--r--core/vm/oracle_contracts.go10
3 files changed, 20 insertions, 7 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 5e3b4b30a..34235c10b 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -293,7 +293,7 @@ type blockInfo struct {
}
func (bc *BlockChain) AddConfirmedBlock(block *coreTypes.Block) error {
- chainID := block.Position.ChainID
+ chainID := uint32(0)
bc.confirmedBlockInitMu.Lock()
_, exist := bc.confirmedBlocks[chainID]
if !exist {
diff --git a/core/governance.go b/core/governance.go
index 9929867c9..03f53ae6b 100644
--- a/core/governance.go
+++ b/core/governance.go
@@ -91,12 +91,11 @@ func (g *Governance) Configuration(round uint64) *coreTypes.Config {
configHelper := g.GetGovStateHelperAtRound(round)
c := configHelper.Configuration()
return &coreTypes.Config{
- LambdaBA: time.Duration(c.LambdaBA) * time.Millisecond,
- LambdaDKG: time.Duration(c.LambdaDKG) * time.Millisecond,
- NotarySetSize: c.NotarySetSize,
- DKGSetSize: c.DKGSetSize,
- // TODO(jimmyhu): remove MinBlockInterval after coreTypes.Config update.
- RoundInterval: time.Duration(c.RoundLength) * time.Duration(c.MinBlockInterval) * time.Millisecond,
+ LambdaBA: time.Duration(c.LambdaBA) * time.Millisecond,
+ LambdaDKG: time.Duration(c.LambdaDKG) * time.Millisecond,
+ NotarySetSize: c.NotarySetSize,
+ DKGSetSize: c.DKGSetSize,
+ RoundLength: c.RoundLength,
MinBlockInterval: time.Duration(c.MinBlockInterval) * time.Millisecond,
}
}
@@ -138,3 +137,7 @@ func (g *Governance) IsDKGFinal(round uint64) bool {
func (g *Governance) MinGasPrice(round uint64) *big.Int {
return g.GetGovStateHelperAtRound(round).MinGasPrice()
}
+
+func (g *Governance) DKGResetCount(round uint64) uint64 {
+ return g.GetHeadHelper().DKGResetCount(big.NewInt(int64(round))).Uint64()
+}
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go
index 826e0396c..aa93c97fb 100644
--- a/core/vm/oracle_contracts.go
+++ b/core/vm/oracle_contracts.go
@@ -2469,6 +2469,16 @@ func PackReportForkBlock(block1, block2 *coreTypes.Block) ([]byte, error) {
return data, nil
}
+func PackResetDKG(newSignedCRS []byte) ([]byte, error) {
+ method := GovernanceABI.Name2Method["resetDKG"]
+ res, err := method.Inputs.Pack(newSignedCRS)
+ if err != nil {
+ return nil, err
+ }
+ data := append(method.Id(), res...)
+ return data, nil
+}
+
// NodeInfoOracleContract representing a oracle providing the node information.
type NodeInfoOracleContract struct {
}