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
81ceac1b
Commit
81ceac1b
authored
Jun 08, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1209 from obscuren/txpool_test_and_pending_fix
core: added a test for missing nonces
parents
55b7c145
5245bd7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
transaction_pool.go
core/transaction_pool.go
+1
-1
transaction_pool_test.go
core/transaction_pool_test.go
+23
-0
No files found.
core/transaction_pool.go
View file @
81ceac1b
...
...
@@ -331,7 +331,7 @@ func (pool *TxPool) checkQueue() {
// current account nonce.
sort
.
Sort
(
addq
)
for
_
,
e
:=
range
addq
{
if
e
.
AccountNonce
>
curnonce
+
1
{
if
e
.
AccountNonce
>
curnonce
{
break
}
delete
(
txs
,
e
.
hash
)
...
...
core/transaction_pool_test.go
View file @
81ceac1b
...
...
@@ -201,3 +201,26 @@ func TestTransactionDoubleNonce(t *testing.T) {
t
.
Error
(
"expected 2 pending txs. Got"
,
len
(
pool
.
pending
))
}
}
func
TestMissingNonce
(
t
*
testing
.
T
)
{
pool
,
key
:=
setupTxPool
()
addr
:=
crypto
.
PubkeyToAddress
(
key
.
PublicKey
)
pool
.
currentState
()
.
AddBalance
(
addr
,
big
.
NewInt
(
100000000000000
))
tx
:=
transaction
()
tx
.
AccountNonce
=
1
tx
.
GasLimit
=
big
.
NewInt
(
100000
)
tx
.
SignECDSA
(
key
)
err
:=
pool
.
add
(
tx
)
if
err
!=
nil
{
t
.
Error
(
"didn't expect error"
,
err
)
}
if
len
(
pool
.
pending
)
!=
0
{
t
.
Error
(
"expected 0 pending transactions, got"
,
len
(
pool
.
pending
))
}
if
len
(
pool
.
queue
[
addr
])
!=
1
{
t
.
Error
(
"expected 1 queued transaction, got"
,
len
(
pool
.
queue
[
addr
]))
}
}
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