diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-05-07 19:35:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 19:35:06 +0800 |
commit | 6cf0ab38bd0af77d81aad4c104979cebee9e3e63 (patch) | |
tree | 142d6f965c44dcf9e2182da67b7bbc978c573448 /les/odr_test.go | |
parent | 5463ed99968bf71685a2a8ee9dbf8705912f00cb (diff) | |
download | dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.gz dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.bz2 dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.lz dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.xz dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.zst dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.zip |
core/rawdb: separate raw database access to own package (#16666)
Diffstat (limited to 'les/odr_test.go')
-rw-r--r-- | les/odr_test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/les/odr_test.go b/les/odr_test.go index 88e121cda..9973df043 100644 --- a/les/odr_test.go +++ b/les/odr_test.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -63,9 +64,13 @@ func TestOdrGetReceiptsLes2(t *testing.T) { testOdr(t, 2, 1, odrGetReceipts) } func odrGetReceipts(ctx context.Context, db ethdb.Database, config *params.ChainConfig, bc *core.BlockChain, lc *light.LightChain, bhash common.Hash) []byte { var receipts types.Receipts if bc != nil { - receipts = core.GetBlockReceipts(db, bhash, core.GetBlockNumber(db, bhash)) + if number := rawdb.ReadHeaderNumber(db, bhash); number != nil { + receipts = rawdb.ReadReceipts(db, bhash, *number) + } } else { - receipts, _ = light.GetBlockReceipts(ctx, lc.Odr(), bhash, core.GetBlockNumber(db, bhash)) + if number := rawdb.ReadHeaderNumber(db, bhash); number != nil { + receipts, _ = light.GetBlockReceipts(ctx, lc.Odr(), bhash, *number) + } } if receipts == nil { return nil @@ -178,7 +183,7 @@ func testOdr(t *testing.T, protocol int, expFail uint64, fn odrTestFn) { test := func(expFail uint64) { for i := uint64(0); i <= pm.blockchain.CurrentHeader().Number.Uint64(); i++ { - bhash := core.GetCanonicalHash(db, i) + bhash := rawdb.ReadCanonicalHash(db, i) b1 := fn(light.NoOdr, db, pm.chainConfig, pm.blockchain.(*core.BlockChain), nil, bhash) ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond) |