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
60d9611c
Commit
60d9611c
authored
Jan 07, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests where txs weren't properly removed
parent
f0ec7512
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
transaction_pool.go
core/transaction_pool.go
+5
-5
No files found.
core/transaction_pool.go
View file @
60d9611c
...
@@ -56,11 +56,6 @@ func NewTxPool(eventMux *event.TypeMux) *TxPool {
...
@@ -56,11 +56,6 @@ func NewTxPool(eventMux *event.TypeMux) *TxPool {
}
}
func
(
pool
*
TxPool
)
ValidateTransaction
(
tx
*
types
.
Transaction
)
error
{
func
(
pool
*
TxPool
)
ValidateTransaction
(
tx
*
types
.
Transaction
)
error
{
hash
:=
tx
.
Hash
()
if
pool
.
txs
[
string
(
hash
)]
!=
nil
{
return
fmt
.
Errorf
(
"Known transaction (%x)"
,
hash
[
0
:
4
])
}
if
len
(
tx
.
To
())
!=
0
&&
len
(
tx
.
To
())
!=
20
{
if
len
(
tx
.
To
())
!=
0
&&
len
(
tx
.
To
())
!=
20
{
return
fmt
.
Errorf
(
"Invalid recipient. len = %d"
,
len
(
tx
.
To
()))
return
fmt
.
Errorf
(
"Invalid recipient. len = %d"
,
len
(
tx
.
To
()))
}
}
...
@@ -97,6 +92,10 @@ func (self *TxPool) addTx(tx *types.Transaction) {
...
@@ -97,6 +92,10 @@ func (self *TxPool) addTx(tx *types.Transaction) {
}
}
func
(
self
*
TxPool
)
Add
(
tx
*
types
.
Transaction
)
error
{
func
(
self
*
TxPool
)
Add
(
tx
*
types
.
Transaction
)
error
{
if
self
.
txs
[
string
(
tx
.
Hash
())]
!=
nil
{
return
fmt
.
Errorf
(
"Known transaction (%x)"
,
tx
.
Hash
()[
0
:
4
])
}
err
:=
self
.
ValidateTransaction
(
tx
)
err
:=
self
.
ValidateTransaction
(
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -149,6 +148,7 @@ func (pool *TxPool) RemoveInvalid(query StateQuery) {
...
@@ -149,6 +148,7 @@ func (pool *TxPool) RemoveInvalid(query StateQuery) {
for
_
,
tx
:=
range
pool
.
txs
{
for
_
,
tx
:=
range
pool
.
txs
{
sender
:=
query
.
GetAccount
(
tx
.
From
())
sender
:=
query
.
GetAccount
(
tx
.
From
())
err
:=
pool
.
ValidateTransaction
(
tx
)
err
:=
pool
.
ValidateTransaction
(
tx
)
fmt
.
Println
(
err
,
sender
.
Nonce
,
tx
.
Nonce
())
if
err
!=
nil
||
sender
.
Nonce
>=
tx
.
Nonce
()
{
if
err
!=
nil
||
sender
.
Nonce
>=
tx
.
Nonce
()
{
removedTxs
=
append
(
removedTxs
,
tx
)
removedTxs
=
append
(
removedTxs
,
tx
)
}
}
...
...
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