diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-24 15:05:24 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:56 +0800 |
commit | 87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0 (patch) | |
tree | 7243672ff3235c5fc741b09e0cadf7c69a7c6ec8 /dex | |
parent | 6f9f78e54ceb93db5495a3e15568efbfa9e5b25b (diff) | |
download | dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.tar dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.tar.gz dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.tar.bz2 dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.tar.lz dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.tar.xz dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.tar.zst dexon-87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0.zip |
consensus: dexcon: snapshot round height when finalizing block (#170)
Instead of having BP to send a tx to register the round height, just
modify the state when finalizing block.
Diffstat (limited to 'dex')
-rw-r--r-- | dex/app_test.go | 6 | ||||
-rw-r--r-- | dex/downloader/testchain_test.go | 9 | ||||
-rw-r--r-- | dex/governance.go | 14 |
3 files changed, 0 insertions, 29 deletions
diff --git a/dex/app_test.go b/dex/app_test.go index 34b31d3d3..d2837b174 100644 --- a/dex/app_test.go +++ b/dex/app_test.go @@ -513,12 +513,6 @@ func TestNumChainsChange(t *testing.T) { Height: 1, }) - // Snapshot round on round 1 and height 2. - input, err = abiObject.Pack("snapshotRound", big.NewInt(1), big.NewInt(1)) - if err != nil { - t.Fatalf("abiObject pack error: %v", err) - } - block, err = prepareConfirmedBlockWithTxAndData(dex, key, [][]byte{input}, 1) if err != nil { t.Fatalf("prepare block error: %v", err) diff --git a/dex/downloader/testchain_test.go b/dex/downloader/testchain_test.go index d96ebcfbf..73d4863a5 100644 --- a/dex/downloader/testchain_test.go +++ b/dex/downloader/testchain_test.go @@ -201,15 +201,6 @@ func (tc *testChain) generate(n int, seed byte, parent *types.Block, nodes *dexc half := roundInterval / 2 switch i % roundInterval { - case 0: - if round > 0 { - node := testNodes.Nodes(round)[0] - data, err := vm.PackNotifyRoundHeight(round, uint64(i)) - if err != nil { - panic(err) - } - addTx(block, node, data) - } case half: // Sign current CRS to geneate the next round CRS and propose it. testNodes.SignCRS(round) diff --git a/dex/governance.go b/dex/governance.go index e9ea1f89c..1b037cf2b 100644 --- a/dex/governance.go +++ b/dex/governance.go @@ -145,20 +145,6 @@ func (d *DexconGovernance) NodeSet(round uint64) []coreCrypto.PublicKey { return pks } -// NotifyRoundHeight register the mapping between round and height. -func (d *DexconGovernance) NotifyRoundHeight(targetRound, consensusHeight uint64) { - data, err := vm.PackNotifyRoundHeight(targetRound, consensusHeight) - if err != nil { - log.Error("failed to pack snapshotRound input", "err", err) - return - } - - err = d.sendGovTx(context.Background(), data) - if err != nil { - log.Error("failed to send snapshotRound tx", "err", err) - } -} - // AddDKGComplaint adds a DKGComplaint. func (d *DexconGovernance) AddDKGComplaint(round uint64, complaint *dkgTypes.Complaint) { data, err := vm.PackAddDKGComplaint(round, complaint) |