miner: differentiate between uncle and lost block
This commit is contained in:
@ -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)}))
|
||||
}
|
||||
|
Reference in New Issue
Block a user