diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-03-17 09:12:50 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:23 +0800 |
commit | 9493109f2be4507605e6b17e406bf8fd147ab3c8 (patch) | |
tree | 84fee3d1fb2095ff5ba793bdfccba89970bc8f89 /core | |
parent | 9ee92eff068b09246ab6446efa39abfc0c7bd8a8 (diff) | |
download | go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.gz go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.bz2 go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.lz go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.xz go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.zst go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.zip |
dex: implement recovery mechanism (#258)
* dex: implement recovery mechanism
The DEXON recovery protocol allows us to use the Ethereum blockchain as a
fallback consensus chain to coordinate recovery.
* fix
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/oracle_contracts.go | 8 | ||||
-rw-r--r-- | core/vm/oracle_contracts_test.go | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go index 37e734a5f..d983cdfc8 100644 --- a/core/vm/oracle_contracts.go +++ b/core/vm/oracle_contracts.go @@ -95,7 +95,7 @@ func publicKeyToNodeKeyAddress(pkBytes []byte) (common.Address, error) { return crypto.PubkeyToAddress(*pk), nil } -func idToAddress(id coreTypes.NodeID) common.Address { +func IdToAddress(id coreTypes.NodeID) common.Address { return common.BytesToAddress(id.Hash[12:]) } @@ -517,7 +517,7 @@ func (s *GovernanceState) DeleteNodeOffsets(n *nodeInfo) error { } func (s *GovernanceState) GetNodeByID(id coreTypes.NodeID) (*nodeInfo, error) { - offset := s.NodesOffsetByNodeKeyAddress(idToAddress(id)) + offset := s.NodesOffsetByNodeKeyAddress(IdToAddress(id)) if offset.Cmp(big.NewInt(0)) < 0 { return nil, errors.New("node not found") } @@ -630,7 +630,7 @@ func (s *GovernanceState) PutDKGMPKReady(addr common.Address, ready bool) { } func (s *GovernanceState) ClearDKGMPKReady(dkgSet map[coreTypes.NodeID]struct{}) { for id := range dkgSet { - s.PutDKGMPKReady(idToAddress(id), false) + s.PutDKGMPKReady(IdToAddress(id), false) } } @@ -661,7 +661,7 @@ func (s *GovernanceState) PutDKGFinalized(addr common.Address, finalized bool) { } func (s *GovernanceState) ClearDKGFinalized(dkgSet map[coreTypes.NodeID]struct{}) { for id := range dkgSet { - s.PutDKGFinalized(idToAddress(id), false) + s.PutDKGFinalized(IdToAddress(id), false) } } diff --git a/core/vm/oracle_contracts_test.go b/core/vm/oracle_contracts_test.go index 4539f0864..6e2a7fc7f 100644 --- a/core/vm/oracle_contracts_test.go +++ b/core/vm/oracle_contracts_test.go @@ -933,7 +933,7 @@ func (g *OracleContractsTestSuite) TestResetDKG() { dkgSets[round] = dkgSet for id := range dkgSet { - offset := g.s.NodesOffsetByNodeKeyAddress(idToAddress(id)) + offset := g.s.NodesOffsetByNodeKeyAddress(IdToAddress(id)) if offset.Cmp(big.NewInt(0)) < 0 { panic("DKG node does not exist") } |