Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
a4bc2c31
Unverified
Commit
a4bc2c31
authored
Aug 29, 2018
by
Péter Szilágyi
Committed by
GitHub
Aug 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17540 from karalabe/miner-uncle-fix
miner: track uncles more aggressively
parents
75ae5af6
f751c6ed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
51 deletions
+63
-51
worker.go
miner/worker.go
+15
-17
worker_test.go
miner/worker_test.go
+48
-34
No files found.
miner/worker.go
View file @
a4bc2c31
...
@@ -18,7 +18,7 @@ package miner
...
@@ -18,7 +18,7 @@ package miner
import
(
import
(
"bytes"
"bytes"
"
fmt
"
"
errors
"
"math/big"
"math/big"
"sync"
"sync"
"sync/atomic"
"sync/atomic"
...
@@ -620,13 +620,16 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
...
@@ -620,13 +620,16 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
func
(
w
*
worker
)
commitUncle
(
env
*
environment
,
uncle
*
types
.
Header
)
error
{
func
(
w
*
worker
)
commitUncle
(
env
*
environment
,
uncle
*
types
.
Header
)
error
{
hash
:=
uncle
.
Hash
()
hash
:=
uncle
.
Hash
()
if
env
.
uncles
.
Contains
(
hash
)
{
if
env
.
uncles
.
Contains
(
hash
)
{
return
fmt
.
Errorf
(
"uncle not unique"
)
return
errors
.
New
(
"uncle not unique"
)
}
if
env
.
header
.
ParentHash
==
uncle
.
ParentHash
{
return
errors
.
New
(
"uncle is sibling"
)
}
}
if
!
env
.
ancestors
.
Contains
(
uncle
.
ParentHash
)
{
if
!
env
.
ancestors
.
Contains
(
uncle
.
ParentHash
)
{
return
fmt
.
Errorf
(
"uncle's parent unknown (%x)"
,
uncle
.
ParentHash
[
0
:
4
]
)
return
errors
.
New
(
"uncle's parent unknown"
)
}
}
if
env
.
family
.
Contains
(
hash
)
{
if
env
.
family
.
Contains
(
hash
)
{
return
fmt
.
Errorf
(
"uncle already in family (%x)"
,
hash
)
return
errors
.
New
(
"uncle already included"
)
}
}
env
.
uncles
.
Add
(
uncle
.
Hash
())
env
.
uncles
.
Add
(
uncle
.
Hash
())
return
nil
return
nil
...
@@ -852,29 +855,24 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool) {
...
@@ -852,29 +855,24 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool) {
if
w
.
config
.
DAOForkSupport
&&
w
.
config
.
DAOForkBlock
!=
nil
&&
w
.
config
.
DAOForkBlock
.
Cmp
(
header
.
Number
)
==
0
{
if
w
.
config
.
DAOForkSupport
&&
w
.
config
.
DAOForkBlock
!=
nil
&&
w
.
config
.
DAOForkBlock
.
Cmp
(
header
.
Number
)
==
0
{
misc
.
ApplyDAOHardFork
(
env
.
state
)
misc
.
ApplyDAOHardFork
(
env
.
state
)
}
}
// Accumulate the uncles for the current block
// compute uncles for the new block.
for
hash
,
uncle
:=
range
w
.
possibleUncles
{
var
(
if
uncle
.
NumberU64
()
+
staleThreshold
<=
header
.
Number
.
Uint64
()
{
uncles
[]
*
types
.
Header
delete
(
w
.
possibleUncles
,
hash
)
badUncles
[]
common
.
Hash
}
)
}
uncles
:=
make
([]
*
types
.
Header
,
0
,
2
)
for
hash
,
uncle
:=
range
w
.
possibleUncles
{
for
hash
,
uncle
:=
range
w
.
possibleUncles
{
if
len
(
uncles
)
==
2
{
if
len
(
uncles
)
==
2
{
break
break
}
}
if
err
:=
w
.
commitUncle
(
env
,
uncle
.
Header
());
err
!=
nil
{
if
err
:=
w
.
commitUncle
(
env
,
uncle
.
Header
());
err
!=
nil
{
log
.
Trace
(
"Bad uncle found and will be removed"
,
"hash"
,
hash
)
log
.
Trace
(
"Possible uncle rejected"
,
"hash"
,
hash
,
"reason"
,
err
)
log
.
Trace
(
fmt
.
Sprint
(
uncle
))
badUncles
=
append
(
badUncles
,
hash
)
}
else
{
}
else
{
log
.
Debug
(
"Committing new uncle to block"
,
"hash"
,
hash
)
log
.
Debug
(
"Committing new uncle to block"
,
"hash"
,
hash
)
uncles
=
append
(
uncles
,
uncle
.
Header
())
uncles
=
append
(
uncles
,
uncle
.
Header
())
}
}
}
}
for
_
,
hash
:=
range
badUncles
{
delete
(
w
.
possibleUncles
,
hash
)
}
if
!
noempty
{
if
!
noempty
{
// Create an empty block based on temporary copied state for sealing in advance without waiting block
// Create an empty block based on temporary copied state for sealing in advance without waiting block
...
...
miner/worker_test.go
View file @
a4bc2c31
...
@@ -45,8 +45,8 @@ var (
...
@@ -45,8 +45,8 @@ var (
testBankAddress
=
crypto
.
PubkeyToAddress
(
testBankKey
.
PublicKey
)
testBankAddress
=
crypto
.
PubkeyToAddress
(
testBankKey
.
PublicKey
)
testBankFunds
=
big
.
NewInt
(
1000000000000000000
)
testBankFunds
=
big
.
NewInt
(
1000000000000000000
)
acc1Key
,
_
=
crypto
.
GenerateKey
()
testUserKey
,
_
=
crypto
.
GenerateKey
()
acc1Addr
=
crypto
.
PubkeyToAddress
(
acc1
Key
.
PublicKey
)
testUserAddress
=
crypto
.
PubkeyToAddress
(
testUser
Key
.
PublicKey
)
// Test transactions
// Test transactions
pendingTxs
[]
*
types
.
Transaction
pendingTxs
[]
*
types
.
Transaction
...
@@ -62,9 +62,9 @@ func init() {
...
@@ -62,9 +62,9 @@ func init() {
Period
:
10
,
Period
:
10
,
Epoch
:
30000
,
Epoch
:
30000
,
}
}
tx1
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
0
,
acc1Addr
,
big
.
NewInt
(
1000
),
params
.
TxGas
,
nil
,
nil
),
types
.
HomesteadSigner
{},
testBankKey
)
tx1
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
0
,
testUserAddress
,
big
.
NewInt
(
1000
),
params
.
TxGas
,
nil
,
nil
),
types
.
HomesteadSigner
{},
testBankKey
)
pendingTxs
=
append
(
pendingTxs
,
tx1
)
pendingTxs
=
append
(
pendingTxs
,
tx1
)
tx2
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
1
,
acc1Addr
,
big
.
NewInt
(
1000
),
params
.
TxGas
,
nil
,
nil
),
types
.
HomesteadSigner
{},
testBankKey
)
tx2
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
1
,
testUserAddress
,
big
.
NewInt
(
1000
),
params
.
TxGas
,
nil
,
nil
),
types
.
HomesteadSigner
{},
testBankKey
)
newTxs
=
append
(
newTxs
,
tx2
)
newTxs
=
append
(
newTxs
,
tx2
)
}
}
...
@@ -77,7 +77,7 @@ type testWorkerBackend struct {
...
@@ -77,7 +77,7 @@ type testWorkerBackend struct {
uncleBlock
*
types
.
Block
uncleBlock
*
types
.
Block
}
}
func
newTestWorkerBackend
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
*
testWorkerBackend
{
func
newTestWorkerBackend
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
,
n
int
)
*
testWorkerBackend
{
var
(
var
(
db
=
ethdb
.
NewMemDatabase
()
db
=
ethdb
.
NewMemDatabase
()
gspec
=
core
.
Genesis
{
gspec
=
core
.
Genesis
{
...
@@ -92,14 +92,28 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
...
@@ -92,14 +92,28 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
copy
(
gspec
.
ExtraData
[
32
:
],
testBankAddress
[
:
])
copy
(
gspec
.
ExtraData
[
32
:
],
testBankAddress
[
:
])
case
*
ethash
.
Ethash
:
case
*
ethash
.
Ethash
:
default
:
default
:
t
.
Fatal
(
"unexpect consensus engine type"
)
t
.
Fatal
f
(
"unexpected consensus engine type: %T"
,
engine
)
}
}
genesis
:=
gspec
.
MustCommit
(
db
)
genesis
:=
gspec
.
MustCommit
(
db
)
chain
,
_
:=
core
.
NewBlockChain
(
db
,
nil
,
gspec
.
Config
,
engine
,
vm
.
Config
{})
chain
,
_
:=
core
.
NewBlockChain
(
db
,
nil
,
gspec
.
Config
,
engine
,
vm
.
Config
{})
txpool
:=
core
.
NewTxPool
(
testTxPoolConfig
,
chainConfig
,
chain
)
txpool
:=
core
.
NewTxPool
(
testTxPoolConfig
,
chainConfig
,
chain
)
blocks
,
_
:=
core
.
GenerateChain
(
chainConfig
,
genesis
,
engine
,
db
,
1
,
func
(
i
int
,
gen
*
core
.
BlockGen
)
{
gen
.
SetCoinbase
(
acc1Addr
)
// Generate a small n-block chain and an uncle block for it
if
n
>
0
{
blocks
,
_
:=
core
.
GenerateChain
(
chainConfig
,
genesis
,
engine
,
db
,
n
,
func
(
i
int
,
gen
*
core
.
BlockGen
)
{
gen
.
SetCoinbase
(
testBankAddress
)
})
if
_
,
err
:=
chain
.
InsertChain
(
blocks
);
err
!=
nil
{
t
.
Fatalf
(
"failed to insert origin chain: %v"
,
err
)
}
}
parent
:=
genesis
if
n
>
0
{
parent
=
chain
.
GetBlockByHash
(
chain
.
CurrentBlock
()
.
ParentHash
())
}
blocks
,
_
:=
core
.
GenerateChain
(
chainConfig
,
parent
,
engine
,
db
,
1
,
func
(
i
int
,
gen
*
core
.
BlockGen
)
{
gen
.
SetCoinbase
(
testUserAddress
)
})
})
return
&
testWorkerBackend
{
return
&
testWorkerBackend
{
...
@@ -116,8 +130,8 @@ func (b *testWorkerBackend) PostChainEvents(events []interface{}) {
...
@@ -116,8 +130,8 @@ func (b *testWorkerBackend) PostChainEvents(events []interface{}) {
b
.
chain
.
PostChainEvents
(
events
,
nil
)
b
.
chain
.
PostChainEvents
(
events
,
nil
)
}
}
func
newTestWorker
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
(
*
worker
,
*
testWorkerBackend
)
{
func
newTestWorker
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
,
blocks
int
)
(
*
worker
,
*
testWorkerBackend
)
{
backend
:=
newTestWorkerBackend
(
t
,
chainConfig
,
engine
)
backend
:=
newTestWorkerBackend
(
t
,
chainConfig
,
engine
,
blocks
)
backend
.
txPool
.
AddLocals
(
pendingTxs
)
backend
.
txPool
.
AddLocals
(
pendingTxs
)
w
:=
newWorker
(
chainConfig
,
engine
,
backend
,
new
(
event
.
TypeMux
),
time
.
Second
,
params
.
GenesisGasLimit
,
params
.
GenesisGasLimit
)
w
:=
newWorker
(
chainConfig
,
engine
,
backend
,
new
(
event
.
TypeMux
),
time
.
Second
,
params
.
GenesisGasLimit
,
params
.
GenesisGasLimit
)
w
.
setEtherbase
(
testBankAddress
)
w
.
setEtherbase
(
testBankAddress
)
...
@@ -134,24 +148,24 @@ func TestPendingStateAndBlockClique(t *testing.T) {
...
@@ -134,24 +148,24 @@ func TestPendingStateAndBlockClique(t *testing.T) {
func
testPendingStateAndBlock
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
func
testPendingStateAndBlock
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
defer
engine
.
Close
()
defer
engine
.
Close
()
w
,
b
:=
newTestWorker
(
t
,
chainConfig
,
engine
)
w
,
b
:=
newTestWorker
(
t
,
chainConfig
,
engine
,
0
)
defer
w
.
close
()
defer
w
.
close
()
// Ensure snapshot has been updated.
// Ensure snapshot has been updated.
time
.
Sleep
(
100
*
time
.
Millisecond
)
time
.
Sleep
(
100
*
time
.
Millisecond
)
block
,
state
:=
w
.
pending
()
block
,
state
:=
w
.
pending
()
if
block
.
NumberU64
()
!=
1
{
if
block
.
NumberU64
()
!=
1
{
t
.
Errorf
(
"block number mismatch
, has
%d, want %d"
,
block
.
NumberU64
(),
1
)
t
.
Errorf
(
"block number mismatch
: have
%d, want %d"
,
block
.
NumberU64
(),
1
)
}
}
if
balance
:=
state
.
GetBalance
(
acc1Addr
);
balance
.
Cmp
(
big
.
NewInt
(
1000
))
!=
0
{
if
balance
:=
state
.
GetBalance
(
testUserAddress
);
balance
.
Cmp
(
big
.
NewInt
(
1000
))
!=
0
{
t
.
Errorf
(
"account balance mismatch
, has
%d, want %d"
,
balance
,
1000
)
t
.
Errorf
(
"account balance mismatch
: have
%d, want %d"
,
balance
,
1000
)
}
}
b
.
txPool
.
AddLocals
(
newTxs
)
b
.
txPool
.
AddLocals
(
newTxs
)
// Ensure the new tx events has been processed
// Ensure the new tx events has been processed
time
.
Sleep
(
100
*
time
.
Millisecond
)
time
.
Sleep
(
100
*
time
.
Millisecond
)
block
,
state
=
w
.
pending
()
block
,
state
=
w
.
pending
()
if
balance
:=
state
.
GetBalance
(
acc1Addr
);
balance
.
Cmp
(
big
.
NewInt
(
2000
))
!=
0
{
if
balance
:=
state
.
GetBalance
(
testUserAddress
);
balance
.
Cmp
(
big
.
NewInt
(
2000
))
!=
0
{
t
.
Errorf
(
"account balance mismatch
, has
%d, want %d"
,
balance
,
2000
)
t
.
Errorf
(
"account balance mismatch
: have
%d, want %d"
,
balance
,
2000
)
}
}
}
}
...
@@ -165,7 +179,7 @@ func TestEmptyWorkClique(t *testing.T) {
...
@@ -165,7 +179,7 @@ func TestEmptyWorkClique(t *testing.T) {
func
testEmptyWork
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
func
testEmptyWork
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
defer
engine
.
Close
()
defer
engine
.
Close
()
w
,
_
:=
newTestWorker
(
t
,
chainConfig
,
engine
)
w
,
_
:=
newTestWorker
(
t
,
chainConfig
,
engine
,
0
)
defer
w
.
close
()
defer
w
.
close
()
var
(
var
(
...
@@ -179,10 +193,10 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
...
@@ -179,10 +193,10 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
receiptLen
,
balance
=
1
,
big
.
NewInt
(
1000
)
receiptLen
,
balance
=
1
,
big
.
NewInt
(
1000
)
}
}
if
len
(
task
.
receipts
)
!=
receiptLen
{
if
len
(
task
.
receipts
)
!=
receiptLen
{
t
.
Errorf
(
"receipt number mismatch
has
%d, want %d"
,
len
(
task
.
receipts
),
receiptLen
)
t
.
Errorf
(
"receipt number mismatch
: have
%d, want %d"
,
len
(
task
.
receipts
),
receiptLen
)
}
}
if
task
.
state
.
GetBalance
(
acc1Addr
)
.
Cmp
(
balance
)
!=
0
{
if
task
.
state
.
GetBalance
(
testUserAddress
)
.
Cmp
(
balance
)
!=
0
{
t
.
Errorf
(
"account balance mismatch
has %d, want %d"
,
task
.
state
.
GetBalance
(
acc1Addr
),
balance
)
t
.
Errorf
(
"account balance mismatch
: have %d, want %d"
,
task
.
state
.
GetBalance
(
testUserAddress
),
balance
)
}
}
}
}
...
@@ -219,19 +233,19 @@ func TestStreamUncleBlock(t *testing.T) {
...
@@ -219,19 +233,19 @@ func TestStreamUncleBlock(t *testing.T) {
ethash
:=
ethash
.
NewFaker
()
ethash
:=
ethash
.
NewFaker
()
defer
ethash
.
Close
()
defer
ethash
.
Close
()
w
,
b
:=
newTestWorker
(
t
,
ethashChainConfig
,
ethash
)
w
,
b
:=
newTestWorker
(
t
,
ethashChainConfig
,
ethash
,
1
)
defer
w
.
close
()
defer
w
.
close
()
var
taskCh
=
make
(
chan
struct
{})
var
taskCh
=
make
(
chan
struct
{})
taskIndex
:=
0
taskIndex
:=
0
w
.
newTaskHook
=
func
(
task
*
task
)
{
w
.
newTaskHook
=
func
(
task
*
task
)
{
if
task
.
block
.
NumberU64
()
==
1
{
if
task
.
block
.
NumberU64
()
==
2
{
if
taskIndex
==
2
{
if
taskIndex
==
2
{
ha
s
:=
task
.
block
.
Header
()
.
UncleHash
ha
ve
:=
task
.
block
.
Header
()
.
UncleHash
want
:=
types
.
CalcUncleHash
([]
*
types
.
Header
{
b
.
uncleBlock
.
Header
()})
want
:=
types
.
CalcUncleHash
([]
*
types
.
Header
{
b
.
uncleBlock
.
Header
()})
if
ha
s
!=
want
{
if
ha
ve
!=
want
{
t
.
Errorf
(
"uncle hash mismatch
, has %s, want %s"
,
has
.
Hex
(),
want
.
Hex
())
t
.
Errorf
(
"uncle hash mismatch
: have %s, want %s"
,
have
.
Hex
(),
want
.
Hex
())
}
}
}
}
taskCh
<-
struct
{}{}
taskCh
<-
struct
{}{}
...
@@ -248,12 +262,12 @@ func TestStreamUncleBlock(t *testing.T) {
...
@@ -248,12 +262,12 @@ func TestStreamUncleBlock(t *testing.T) {
// Ensure worker has finished initialization
// Ensure worker has finished initialization
for
{
for
{
b
:=
w
.
pendingBlock
()
b
:=
w
.
pendingBlock
()
if
b
!=
nil
&&
b
.
NumberU64
()
==
1
{
if
b
!=
nil
&&
b
.
NumberU64
()
==
2
{
break
break
}
}
}
}
w
.
start
()
w
.
start
()
// Ignore the first two works
// Ignore the first two works
for
i
:=
0
;
i
<
2
;
i
+=
1
{
for
i
:=
0
;
i
<
2
;
i
+=
1
{
select
{
select
{
...
@@ -282,7 +296,7 @@ func TestRegenerateMiningBlockClique(t *testing.T) {
...
@@ -282,7 +296,7 @@ func TestRegenerateMiningBlockClique(t *testing.T) {
func
testRegenerateMiningBlock
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
func
testRegenerateMiningBlock
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
defer
engine
.
Close
()
defer
engine
.
Close
()
w
,
b
:=
newTestWorker
(
t
,
chainConfig
,
engine
)
w
,
b
:=
newTestWorker
(
t
,
chainConfig
,
engine
,
0
)
defer
w
.
close
()
defer
w
.
close
()
var
taskCh
=
make
(
chan
struct
{})
var
taskCh
=
make
(
chan
struct
{})
...
@@ -293,10 +307,10 @@ func testRegenerateMiningBlock(t *testing.T, chainConfig *params.ChainConfig, en
...
@@ -293,10 +307,10 @@ func testRegenerateMiningBlock(t *testing.T, chainConfig *params.ChainConfig, en
if
taskIndex
==
2
{
if
taskIndex
==
2
{
receiptLen
,
balance
:=
2
,
big
.
NewInt
(
2000
)
receiptLen
,
balance
:=
2
,
big
.
NewInt
(
2000
)
if
len
(
task
.
receipts
)
!=
receiptLen
{
if
len
(
task
.
receipts
)
!=
receiptLen
{
t
.
Errorf
(
"receipt number mismatch
has
%d, want %d"
,
len
(
task
.
receipts
),
receiptLen
)
t
.
Errorf
(
"receipt number mismatch
: have
%d, want %d"
,
len
(
task
.
receipts
),
receiptLen
)
}
}
if
task
.
state
.
GetBalance
(
acc1Addr
)
.
Cmp
(
balance
)
!=
0
{
if
task
.
state
.
GetBalance
(
testUserAddress
)
.
Cmp
(
balance
)
!=
0
{
t
.
Errorf
(
"account balance mismatch
has %d, want %d"
,
task
.
state
.
GetBalance
(
acc1Addr
),
balance
)
t
.
Errorf
(
"account balance mismatch
: have %d, want %d"
,
task
.
state
.
GetBalance
(
testUserAddress
),
balance
)
}
}
}
}
taskCh
<-
struct
{}{}
taskCh
<-
struct
{}{}
...
@@ -347,7 +361,7 @@ func TestAdjustIntervalClique(t *testing.T) {
...
@@ -347,7 +361,7 @@ func TestAdjustIntervalClique(t *testing.T) {
func
testAdjustInterval
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
func
testAdjustInterval
(
t
*
testing
.
T
,
chainConfig
*
params
.
ChainConfig
,
engine
consensus
.
Engine
)
{
defer
engine
.
Close
()
defer
engine
.
Close
()
w
,
_
:=
newTestWorker
(
t
,
chainConfig
,
engine
)
w
,
_
:=
newTestWorker
(
t
,
chainConfig
,
engine
,
0
)
defer
w
.
close
()
defer
w
.
close
()
w
.
skipSealHook
=
func
(
task
*
task
)
bool
{
w
.
skipSealHook
=
func
(
task
*
task
)
bool
{
...
@@ -387,10 +401,10 @@ func testAdjustInterval(t *testing.T, chainConfig *params.ChainConfig, engine co
...
@@ -387,10 +401,10 @@ func testAdjustInterval(t *testing.T, chainConfig *params.ChainConfig, engine co
// Check interval
// Check interval
if
minInterval
!=
wantMinInterval
{
if
minInterval
!=
wantMinInterval
{
t
.
Errorf
(
"resubmit min interval mismatch
want %s has %s"
,
wantMinInterval
,
m
inInterval
)
t
.
Errorf
(
"resubmit min interval mismatch
: have %v, want %v "
,
minInterval
,
wantM
inInterval
)
}
}
if
recommitInterval
!=
wantRecommitInterval
{
if
recommitInterval
!=
wantRecommitInterval
{
t
.
Errorf
(
"resubmit interval mismatch
want %s has %s"
,
wantRecommitInterval
,
r
ecommitInterval
)
t
.
Errorf
(
"resubmit interval mismatch
: have %v, want %v"
,
recommitInterval
,
wantR
ecommitInterval
)
}
}
result
=
append
(
result
,
float64
(
recommitInterval
.
Nanoseconds
()))
result
=
append
(
result
,
float64
(
recommitInterval
.
Nanoseconds
()))
index
+=
1
index
+=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment