diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-08-23 21:03:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-23 21:03:10 +0800 |
commit | c134e00e488bf4bfd88689ecf6b91ee351fb77e5 (patch) | |
tree | 2ee9858e529c1355fc02461b4ed89b9cab398d35 /miner/unconfirmed_test.go | |
parent | 40a71f28cf1ada0bf6bdcdc2f3c6f31a8da134a2 (diff) | |
parent | 1136269a79e6ee8bc97f5bf277bf8ec12286b79b (diff) | |
download | go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.tar go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.tar.gz go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.tar.bz2 go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.tar.lz go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.tar.xz go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.tar.zst go-tangerine-c134e00e488bf4bfd88689ecf6b91ee351fb77e5.zip |
Merge pull request #17494 from karalabe/mined-block-uncle-check
miner: differentiate between uncle and lost block
Diffstat (limited to 'miner/unconfirmed_test.go')
-rw-r--r-- | miner/unconfirmed_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/miner/unconfirmed_test.go b/miner/unconfirmed_test.go index 456af1764..42e77f3e6 100644 --- a/miner/unconfirmed_test.go +++ b/miner/unconfirmed_test.go @@ -23,11 +23,14 @@ import ( "github.com/ethereum/go-ethereum/core/types" ) -// noopHeaderRetriever is an implementation of headerRetriever that always +// noopChainRetriever is an implementation of headerRetriever that always // returns nil for any requested headers. -type noopHeaderRetriever struct{} +type noopChainRetriever struct{} -func (r *noopHeaderRetriever) GetHeaderByNumber(number uint64) *types.Header { +func (r *noopChainRetriever) GetHeaderByNumber(number uint64) *types.Header { + return nil +} +func (r *noopChainRetriever) GetBlockByNumber(number uint64) *types.Block { return nil } @@ -36,7 +39,7 @@ func (r *noopHeaderRetriever) GetHeaderByNumber(number uint64) *types.Header { func TestUnconfirmedInsertBounds(t *testing.T) { limit := uint(10) - pool := newUnconfirmedBlocks(new(noopHeaderRetriever), limit) + pool := newUnconfirmedBlocks(new(noopChainRetriever), limit) for depth := uint64(0); depth < 2*uint64(limit); depth++ { // Insert multiple blocks for the same level just to stress it for i := 0; i < int(depth); i++ { @@ -58,7 +61,7 @@ func TestUnconfirmedShifts(t *testing.T) { // Create a pool with a few blocks on various depths limit, start := uint(10), uint64(25) - pool := newUnconfirmedBlocks(new(noopHeaderRetriever), limit) + pool := newUnconfirmedBlocks(new(noopChainRetriever), limit) for depth := start; depth < start+uint64(limit); depth++ { pool.Insert(depth, common.Hash([32]byte{byte(depth)})) } |