aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/ethash/ethash_test.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-23 21:02:57 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-23 21:02:57 +0800
commit40a71f28cf1ada0bf6bdcdc2f3c6f31a8da134a2 (patch)
tree70d5c37338def1e3246a3117ac84abca793c476a /consensus/ethash/ethash_test.go
parentc3f7e3be3b60df3edd168e80aa89ee2992932b0d (diff)
downloadgo-tangerine-40a71f28cf1ada0bf6bdcdc2f3c6f31a8da134a2.tar.gz
go-tangerine-40a71f28cf1ada0bf6bdcdc2f3c6f31a8da134a2.tar.zst
go-tangerine-40a71f28cf1ada0bf6bdcdc2f3c6f31a8da134a2.zip
miner: fix state commit, track old work packages too (#17490)
* miner: commit state which is relative with sealing result * consensus, core, miner, mobile: introduce sealHash interface * miner: evict pending task with threshold * miner: go fmt
Diffstat (limited to 'consensus/ethash/ethash_test.go')
-rw-r--r--consensus/ethash/ethash_test.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/consensus/ethash/ethash_test.go b/consensus/ethash/ethash_test.go
index 87ac17c2b..b190d63d6 100644
--- a/consensus/ethash/ethash_test.go
+++ b/consensus/ethash/ethash_test.go
@@ -94,6 +94,7 @@ func TestRemoteSealer(t *testing.T) {
}
header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)}
block := types.NewBlockWithHeader(header)
+ sealhash := ethash.SealHash(header)
// Push new work.
ethash.Seal(nil, block, nil)
@@ -102,27 +103,29 @@ func TestRemoteSealer(t *testing.T) {
work [3]string
err error
)
- if work, err = api.GetWork(); err != nil || work[0] != block.HashNoNonce().Hex() {
+ if work, err = api.GetWork(); err != nil || work[0] != sealhash.Hex() {
t.Error("expect to return a mining work has same hash")
}
- if res := api.SubmitWork(types.BlockNonce{}, block.HashNoNonce(), common.Hash{}); res {
+ if res := api.SubmitWork(types.BlockNonce{}, sealhash, common.Hash{}); res {
t.Error("expect to return false when submit a fake solution")
}
// Push new block with same block number to replace the original one.
header = &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(1000)}
block = types.NewBlockWithHeader(header)
+ sealhash = ethash.SealHash(header)
ethash.Seal(nil, block, nil)
- if work, err = api.GetWork(); err != nil || work[0] != block.HashNoNonce().Hex() {
+ if work, err = api.GetWork(); err != nil || work[0] != sealhash.Hex() {
t.Error("expect to return the latest pushed work")
}
// Push block with higher block number.
newHead := &types.Header{Number: big.NewInt(2), Difficulty: big.NewInt(100)}
newBlock := types.NewBlockWithHeader(newHead)
+ newSealhash := ethash.SealHash(newHead)
ethash.Seal(nil, newBlock, nil)
- if res := api.SubmitWork(types.BlockNonce{}, block.HashNoNonce(), common.Hash{}); res {
+ if res := api.SubmitWork(types.BlockNonce{}, newSealhash, common.Hash{}); res {
t.Error("expect to return false when submit a stale solution")
}
}