diff options
author | Sonic <sonic@dexon.org> | 2018-12-21 14:53:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-21 14:53:37 +0800 |
commit | b680d7be8c4d11fbb1b7ece43bcee93217d0278e (patch) | |
tree | d566e0b07b5a23f8f1dc53cd0b3926b2b060bfb8 /les/handler_test.go | |
parent | e27667c7563e71adc766fb1155c340cca91f33e0 (diff) | |
download | dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.tar dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.tar.gz dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.tar.bz2 dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.tar.lz dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.tar.xz dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.tar.zst dexon-b680d7be8c4d11fbb1b7ece43bcee93217d0278e.zip |
core, dex, internal: block proposer syncing (first iteration) (#96)
* dex, internal: block proposer syncing (first iteration)
* core: find block from db if not in memory
This fix handles stopping proposing and then restarting
* core: no need to reorg when reset
Dexon will not fork. This commit also fix when a block confirm but
its parent is not in db yet, during restarting proposing.
* dex: always accept NewBlockMsg, NewBlockHashesMsg
We need to accept NewBlockMsg, NewBlockHashesMsg to sync current block with
other peers in block proposer mode when syncing lattice data. It's a waste
when the node is synced and start proposing.
Todo: control msg processing on/off more granular, accept NewBlockMsg,
NewBlockHashesMsg when syncing, but stop when synced.
Diffstat (limited to 'les/handler_test.go')
-rw-r--r-- | les/handler_test.go | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/les/handler_test.go b/les/handler_test.go index 6ef6da8e9..eece82a28 100644 --- a/les/handler_test.go +++ b/les/handler_test.go @@ -561,23 +561,4 @@ func TestTransactionStatusLes2(t *testing.T) { block1hash := rawdb.ReadCanonicalHash(db, 1) test(tx1, false, txStatus{Status: core.TxStatusIncluded, Lookup: &rawdb.TxLookupEntry{BlockHash: block1hash, BlockIndex: 1, Index: 0}}) test(tx2, false, txStatus{Status: core.TxStatusIncluded, Lookup: &rawdb.TxLookupEntry{BlockHash: block1hash, BlockIndex: 1, Index: 1}}) - - // create a reorg that rolls them back - gchain, _ = core.GenerateChain(params.TestChainConfig, chain.GetBlockByNumber(0), ethash.NewFaker(), db, 2, func(i int, block *core.BlockGen) {}) - if _, err := chain.InsertChain(gchain); err != nil { - panic(err) - } - // wait until TxPool processes the reorg - for i := 0; i < 10; i++ { - if pending, _ := txpool.Stats(); pending == 3 { - break - } - time.Sleep(100 * time.Millisecond) - } - if pending, _ := txpool.Stats(); pending != 3 { - t.Fatalf("pending count mismatch: have %d, want 3", pending) - } - // check if their status is pending again - test(tx1, false, txStatus{Status: core.TxStatusPending}) - test(tx2, false, txStatus{Status: core.TxStatusPending}) } |