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
a6dda036
Unverified
Commit
a6dda036
authored
Oct 24, 2022
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: refactor txpool into it's own package in prep for 4844
parent
5f70f9fd
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
408 additions
and
385 deletions
+408
-385
flags.go
cmd/utils/flags.go
+4
-3
blockchain.go
core/blockchain.go
+4
-5
sender_cacher.go
core/sender_cacher.go
+7
-7
journal.go
core/txpool/journal.go
+9
-9
list.go
core/txpool/list.go
+51
-51
list_test.go
core/txpool/list_test.go
+9
-9
noncer.go
core/txpool/noncer.go
+10
-10
txpool.go
core/txpool/txpool.go
+75
-75
txpool_test.go
core/txpool/txpool_test.go
+148
-147
api_backend.go
eth/api_backend.go
+2
-1
backend.go
eth/backend.go
+4
-3
config.go
eth/ethconfig/config.go
+3
-2
gen_config.go
eth/ethconfig/gen_config.go
+3
-2
tx_fetcher.go
eth/fetcher/tx_fetcher.go
+4
-4
tx_fetcher_test.go
eth/fetcher/tx_fetcher_test.go
+4
-4
handler_test.go
eth/protocols/eth/handler_test.go
+4
-3
handler_test.go
les/handler_test.go
+12
-11
odr.go
les/odr.go
+3
-2
odr_test.go
les/odr_test.go
+3
-2
server.go
les/server.go
+2
-1
server_handler.go
les/server_handler.go
+4
-3
server_requests.go
les/server_requests.go
+5
-4
test_helper.go
les/test_helper.go
+3
-2
odr.go
light/odr.go
+2
-1
odr_util.go
light/odr_util.go
+2
-2
txpool.go
light/txpool.go
+4
-3
miner.go
miner/miner.go
+2
-1
miner_test.go
miner/miner_test.go
+5
-4
main.go
miner/stress/1559/main.go
+2
-1
main.go
miner/stress/beacon/main.go
+3
-2
main.go
miner/stress/clique/main.go
+2
-1
main.go
miner/stress/ethash/main.go
+2
-1
worker.go
miner/worker.go
+1
-1
worker_test.go
miner/worker_test.go
+6
-5
les-fuzzer.go
tests/fuzzers/les/les-fuzzer.go
+4
-3
No files found.
cmd/utils/flags.go
View file @
a6dda036
...
@@ -39,6 +39,7 @@ import (
...
@@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
...
@@ -390,13 +391,13 @@ var (
...
@@ -390,13 +391,13 @@ var (
TxPoolJournalFlag
=
&
cli
.
StringFlag
{
TxPoolJournalFlag
=
&
cli
.
StringFlag
{
Name
:
"txpool.journal"
,
Name
:
"txpool.journal"
,
Usage
:
"Disk journal for local transaction to survive node restarts"
,
Usage
:
"Disk journal for local transaction to survive node restarts"
,
Value
:
core
.
DefaultTxPool
Config
.
Journal
,
Value
:
txpool
.
Default
Config
.
Journal
,
Category
:
flags
.
TxPoolCategory
,
Category
:
flags
.
TxPoolCategory
,
}
}
TxPoolRejournalFlag
=
&
cli
.
DurationFlag
{
TxPoolRejournalFlag
=
&
cli
.
DurationFlag
{
Name
:
"txpool.rejournal"
,
Name
:
"txpool.rejournal"
,
Usage
:
"Time interval to regenerate the local transaction journal"
,
Usage
:
"Time interval to regenerate the local transaction journal"
,
Value
:
core
.
DefaultTxPool
Config
.
Rejournal
,
Value
:
txpool
.
Default
Config
.
Rejournal
,
Category
:
flags
.
TxPoolCategory
,
Category
:
flags
.
TxPoolCategory
,
}
}
TxPoolPriceLimitFlag
=
&
cli
.
Uint64Flag
{
TxPoolPriceLimitFlag
=
&
cli
.
Uint64Flag
{
...
@@ -1573,7 +1574,7 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config, light bool) {
...
@@ -1573,7 +1574,7 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config, light bool) {
}
}
}
}
func
setTxPool
(
ctx
*
cli
.
Context
,
cfg
*
core
.
TxPool
Config
)
{
func
setTxPool
(
ctx
*
cli
.
Context
,
cfg
*
txpool
.
Config
)
{
if
ctx
.
IsSet
(
TxPoolLocalsFlag
.
Name
)
{
if
ctx
.
IsSet
(
TxPoolLocalsFlag
.
Name
)
{
locals
:=
strings
.
Split
(
ctx
.
String
(
TxPoolLocalsFlag
.
Name
),
","
)
locals
:=
strings
.
Split
(
ctx
.
String
(
TxPoolLocalsFlag
.
Name
),
","
)
for
_
,
account
:=
range
locals
{
for
_
,
account
:=
range
locals
{
...
...
core/blockchain.go
View file @
a6dda036
...
@@ -77,10 +77,9 @@ var (
...
@@ -77,10 +77,9 @@ var (
blockExecutionTimer
=
metrics
.
NewRegisteredTimer
(
"chain/execution"
,
nil
)
blockExecutionTimer
=
metrics
.
NewRegisteredTimer
(
"chain/execution"
,
nil
)
blockWriteTimer
=
metrics
.
NewRegisteredTimer
(
"chain/write"
,
nil
)
blockWriteTimer
=
metrics
.
NewRegisteredTimer
(
"chain/write"
,
nil
)
blockReorgMeter
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/executes"
,
nil
)
blockReorgMeter
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/executes"
,
nil
)
blockReorgAddMeter
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/add"
,
nil
)
blockReorgAddMeter
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/add"
,
nil
)
blockReorgDropMeter
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/drop"
,
nil
)
blockReorgDropMeter
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/drop"
,
nil
)
blockReorgInvalidatedTx
=
metrics
.
NewRegisteredMeter
(
"chain/reorg/invalidTx"
,
nil
)
blockPrefetchExecuteTimer
=
metrics
.
NewRegisteredTimer
(
"chain/prefetch/executes"
,
nil
)
blockPrefetchExecuteTimer
=
metrics
.
NewRegisteredTimer
(
"chain/prefetch/executes"
,
nil
)
blockPrefetchInterruptMeter
=
metrics
.
NewRegisteredMeter
(
"chain/prefetch/interrupts"
,
nil
)
blockPrefetchInterruptMeter
=
metrics
.
NewRegisteredMeter
(
"chain/prefetch/interrupts"
,
nil
)
...
@@ -1492,7 +1491,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
...
@@ -1492,7 +1491,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
}
}
// Start a parallel signature recovery (signer will fluke on fork transition, minimal perf loss)
// Start a parallel signature recovery (signer will fluke on fork transition, minimal perf loss)
senderCacher
.
r
ecoverFromBlocks
(
types
.
MakeSigner
(
bc
.
chainConfig
,
chain
[
0
]
.
Number
()),
chain
)
SenderCacher
.
R
ecoverFromBlocks
(
types
.
MakeSigner
(
bc
.
chainConfig
,
chain
[
0
]
.
Number
()),
chain
)
var
(
var
(
stats
=
insertStats
{
startTime
:
mclock
.
Now
()}
stats
=
insertStats
{
startTime
:
mclock
.
Now
()}
...
...
core/
tx
_cacher.go
→
core/
sender
_cacher.go
View file @
a6dda036
...
@@ -22,8 +22,8 @@ import (
...
@@ -22,8 +22,8 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
)
)
//
s
enderCacher is a concurrent transaction sender recoverer and cacher.
//
S
enderCacher is a concurrent transaction sender recoverer and cacher.
var
s
enderCacher
=
newTxSenderCacher
(
runtime
.
NumCPU
())
var
S
enderCacher
=
newTxSenderCacher
(
runtime
.
NumCPU
())
// txSenderCacherRequest is a request for recovering transaction senders with a
// txSenderCacherRequest is a request for recovering transaction senders with a
// specific signature scheme and caching it into the transactions themselves.
// specific signature scheme and caching it into the transactions themselves.
...
@@ -67,10 +67,10 @@ func (cacher *txSenderCacher) cache() {
...
@@ -67,10 +67,10 @@ func (cacher *txSenderCacher) cache() {
}
}
}
}
//
r
ecover recovers the senders from a batch of transactions and caches them
//
R
ecover recovers the senders from a batch of transactions and caches them
// back into the same data structures. There is no validation being done, nor
// back into the same data structures. There is no validation being done, nor
// any reaction to invalid signatures. That is up to calling code later.
// any reaction to invalid signatures. That is up to calling code later.
func
(
cacher
*
txSenderCacher
)
r
ecover
(
signer
types
.
Signer
,
txs
[]
*
types
.
Transaction
)
{
func
(
cacher
*
txSenderCacher
)
R
ecover
(
signer
types
.
Signer
,
txs
[]
*
types
.
Transaction
)
{
// If there's nothing to recover, abort
// If there's nothing to recover, abort
if
len
(
txs
)
==
0
{
if
len
(
txs
)
==
0
{
return
return
...
@@ -89,10 +89,10 @@ func (cacher *txSenderCacher) recover(signer types.Signer, txs []*types.Transact
...
@@ -89,10 +89,10 @@ func (cacher *txSenderCacher) recover(signer types.Signer, txs []*types.Transact
}
}
}
}
//
r
ecoverFromBlocks recovers the senders from a batch of blocks and caches them
//
R
ecoverFromBlocks recovers the senders from a batch of blocks and caches them
// back into the same data structures. There is no validation being done, nor
// back into the same data structures. There is no validation being done, nor
// any reaction to invalid signatures. That is up to calling code later.
// any reaction to invalid signatures. That is up to calling code later.
func
(
cacher
*
txSenderCacher
)
r
ecoverFromBlocks
(
signer
types
.
Signer
,
blocks
[]
*
types
.
Block
)
{
func
(
cacher
*
txSenderCacher
)
R
ecoverFromBlocks
(
signer
types
.
Signer
,
blocks
[]
*
types
.
Block
)
{
count
:=
0
count
:=
0
for
_
,
block
:=
range
blocks
{
for
_
,
block
:=
range
blocks
{
count
+=
len
(
block
.
Transactions
())
count
+=
len
(
block
.
Transactions
())
...
@@ -101,5 +101,5 @@ func (cacher *txSenderCacher) recoverFromBlocks(signer types.Signer, blocks []*t
...
@@ -101,5 +101,5 @@ func (cacher *txSenderCacher) recoverFromBlocks(signer types.Signer, blocks []*t
for
_
,
block
:=
range
blocks
{
for
_
,
block
:=
range
blocks
{
txs
=
append
(
txs
,
block
.
Transactions
()
...
)
txs
=
append
(
txs
,
block
.
Transactions
()
...
)
}
}
cacher
.
r
ecover
(
signer
,
txs
)
cacher
.
R
ecover
(
signer
,
txs
)
}
}
core/tx
_
journal.go
→
core/tx
pool/
journal.go
View file @
a6dda036
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package
core
package
txpool
import
(
import
(
"errors"
"errors"
...
@@ -41,23 +41,23 @@ type devNull struct{}
...
@@ -41,23 +41,23 @@ type devNull struct{}
func
(
*
devNull
)
Write
(
p
[]
byte
)
(
n
int
,
err
error
)
{
return
len
(
p
),
nil
}
func
(
*
devNull
)
Write
(
p
[]
byte
)
(
n
int
,
err
error
)
{
return
len
(
p
),
nil
}
func
(
*
devNull
)
Close
()
error
{
return
nil
}
func
(
*
devNull
)
Close
()
error
{
return
nil
}
//
txJ
ournal is a rotating log of transactions with the aim of storing locally
//
j
ournal is a rotating log of transactions with the aim of storing locally
// created transactions to allow non-executed ones to survive node restarts.
// created transactions to allow non-executed ones to survive node restarts.
type
txJ
ournal
struct
{
type
j
ournal
struct
{
path
string
// Filesystem path to store the transactions at
path
string
// Filesystem path to store the transactions at
writer
io
.
WriteCloser
// Output stream to write new transactions into
writer
io
.
WriteCloser
// Output stream to write new transactions into
}
}
// newTxJournal creates a new transaction journal to
// newTxJournal creates a new transaction journal to
func
newTxJournal
(
path
string
)
*
txJ
ournal
{
func
newTxJournal
(
path
string
)
*
j
ournal
{
return
&
txJ
ournal
{
return
&
j
ournal
{
path
:
path
,
path
:
path
,
}
}
}
}
// load parses a transaction journal dump from disk, loading its contents into
// load parses a transaction journal dump from disk, loading its contents into
// the specified pool.
// the specified pool.
func
(
journal
*
txJ
ournal
)
load
(
add
func
([]
*
types
.
Transaction
)
[]
error
)
error
{
func
(
journal
*
j
ournal
)
load
(
add
func
([]
*
types
.
Transaction
)
[]
error
)
error
{
// Open the journal for loading any past transactions
// Open the journal for loading any past transactions
input
,
err
:=
os
.
Open
(
journal
.
path
)
input
,
err
:=
os
.
Open
(
journal
.
path
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
...
@@ -118,7 +118,7 @@ func (journal *txJournal) load(add func([]*types.Transaction) []error) error {
...
@@ -118,7 +118,7 @@ func (journal *txJournal) load(add func([]*types.Transaction) []error) error {
}
}
// insert adds the specified transaction to the local disk journal.
// insert adds the specified transaction to the local disk journal.
func
(
journal
*
txJ
ournal
)
insert
(
tx
*
types
.
Transaction
)
error
{
func
(
journal
*
j
ournal
)
insert
(
tx
*
types
.
Transaction
)
error
{
if
journal
.
writer
==
nil
{
if
journal
.
writer
==
nil
{
return
errNoActiveJournal
return
errNoActiveJournal
}
}
...
@@ -130,7 +130,7 @@ func (journal *txJournal) insert(tx *types.Transaction) error {
...
@@ -130,7 +130,7 @@ func (journal *txJournal) insert(tx *types.Transaction) error {
// rotate regenerates the transaction journal based on the current contents of
// rotate regenerates the transaction journal based on the current contents of
// the transaction pool.
// the transaction pool.
func
(
journal
*
txJ
ournal
)
rotate
(
all
map
[
common
.
Address
]
types
.
Transactions
)
error
{
func
(
journal
*
j
ournal
)
rotate
(
all
map
[
common
.
Address
]
types
.
Transactions
)
error
{
// Close the current journal (if any is open)
// Close the current journal (if any is open)
if
journal
.
writer
!=
nil
{
if
journal
.
writer
!=
nil
{
if
err
:=
journal
.
writer
.
Close
();
err
!=
nil
{
if
err
:=
journal
.
writer
.
Close
();
err
!=
nil
{
...
@@ -170,7 +170,7 @@ func (journal *txJournal) rotate(all map[common.Address]types.Transactions) erro
...
@@ -170,7 +170,7 @@ func (journal *txJournal) rotate(all map[common.Address]types.Transactions) erro
}
}
// close flushes the transaction journal contents to disk and closes the file.
// close flushes the transaction journal contents to disk and closes the file.
func
(
journal
*
txJ
ournal
)
close
()
error
{
func
(
journal
*
j
ournal
)
close
()
error
{
var
err
error
var
err
error
if
journal
.
writer
!=
nil
{
if
journal
.
writer
!=
nil
{
...
...
core/tx
_
list.go
→
core/tx
pool/
list.go
View file @
a6dda036
This diff is collapsed.
Click to expand it.
core/tx
_
list_test.go
→
core/tx
pool/
list_test.go
View file @
a6dda036
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package
core
package
txpool
import
(
import
(
"math/big"
"math/big"
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
// Tests that transactions can be added to strict lists and list contents and
// Tests that transactions can be added to strict lists and list contents and
// nonce boundaries are correctly maintained.
// nonce boundaries are correctly maintained.
func
TestStrict
Tx
ListAdd
(
t
*
testing
.
T
)
{
func
TestStrictListAdd
(
t
*
testing
.
T
)
{
// Generate a list of transactions to insert
// Generate a list of transactions to insert
key
,
_
:=
crypto
.
GenerateKey
()
key
,
_
:=
crypto
.
GenerateKey
()
...
@@ -36,9 +36,9 @@ func TestStrictTxListAdd(t *testing.T) {
...
@@ -36,9 +36,9 @@ func TestStrictTxListAdd(t *testing.T) {
txs
[
i
]
=
transaction
(
uint64
(
i
),
0
,
key
)
txs
[
i
]
=
transaction
(
uint64
(
i
),
0
,
key
)
}
}
// Insert the transactions in a random order
// Insert the transactions in a random order
list
:=
new
Tx
List
(
true
)
list
:=
newList
(
true
)
for
_
,
v
:=
range
rand
.
Perm
(
len
(
txs
))
{
for
_
,
v
:=
range
rand
.
Perm
(
len
(
txs
))
{
list
.
Add
(
txs
[
v
],
Default
TxPool
Config
.
PriceBump
)
list
.
Add
(
txs
[
v
],
DefaultConfig
.
PriceBump
)
}
}
// Verify internal state
// Verify internal state
if
len
(
list
.
txs
.
items
)
!=
len
(
txs
)
{
if
len
(
list
.
txs
.
items
)
!=
len
(
txs
)
{
...
@@ -51,7 +51,7 @@ func TestStrictTxListAdd(t *testing.T) {
...
@@ -51,7 +51,7 @@ func TestStrictTxListAdd(t *testing.T) {
}
}
}
}
func
Benchmark
Tx
ListAdd
(
b
*
testing
.
B
)
{
func
BenchmarkListAdd
(
b
*
testing
.
B
)
{
// Generate a list of transactions to insert
// Generate a list of transactions to insert
key
,
_
:=
crypto
.
GenerateKey
()
key
,
_
:=
crypto
.
GenerateKey
()
...
@@ -60,13 +60,13 @@ func BenchmarkTxListAdd(b *testing.B) {
...
@@ -60,13 +60,13 @@ func BenchmarkTxListAdd(b *testing.B) {
txs
[
i
]
=
transaction
(
uint64
(
i
),
0
,
key
)
txs
[
i
]
=
transaction
(
uint64
(
i
),
0
,
key
)
}
}
// Insert the transactions in a random order
// Insert the transactions in a random order
priceLimit
:=
big
.
NewInt
(
int64
(
Default
TxPool
Config
.
PriceLimit
))
priceLimit
:=
big
.
NewInt
(
int64
(
DefaultConfig
.
PriceLimit
))
b
.
ResetTimer
()
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
list
:=
new
Tx
List
(
true
)
list
:=
newList
(
true
)
for
_
,
v
:=
range
rand
.
Perm
(
len
(
txs
))
{
for
_
,
v
:=
range
rand
.
Perm
(
len
(
txs
))
{
list
.
Add
(
txs
[
v
],
Default
TxPool
Config
.
PriceBump
)
list
.
Add
(
txs
[
v
],
DefaultConfig
.
PriceBump
)
list
.
Filter
(
priceLimit
,
Default
TxPool
Config
.
PriceBump
)
list
.
Filter
(
priceLimit
,
DefaultConfig
.
PriceBump
)
}
}
}
}
}
}
core/tx
_
noncer.go
→
core/tx
pool/
noncer.go
View file @
a6dda036
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package
core
package
txpool
import
(
import
(
"sync"
"sync"
...
@@ -23,18 +23,18 @@ import (
...
@@ -23,18 +23,18 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
)
)
//
txN
oncer is a tiny virtual state database to manage the executable nonces of
//
n
oncer is a tiny virtual state database to manage the executable nonces of
// accounts in the pool, falling back to reading from a real state database if
// accounts in the pool, falling back to reading from a real state database if
// an account is unknown.
// an account is unknown.
type
txN
oncer
struct
{
type
n
oncer
struct
{
fallback
*
state
.
StateDB
fallback
*
state
.
StateDB
nonces
map
[
common
.
Address
]
uint64
nonces
map
[
common
.
Address
]
uint64
lock
sync
.
Mutex
lock
sync
.
Mutex
}
}
// new
Tx
Noncer creates a new virtual state database to track the pool nonces.
// newNoncer creates a new virtual state database to track the pool nonces.
func
new
TxNoncer
(
statedb
*
state
.
StateDB
)
*
txN
oncer
{
func
new
Noncer
(
statedb
*
state
.
StateDB
)
*
n
oncer
{
return
&
txN
oncer
{
return
&
n
oncer
{
fallback
:
statedb
.
Copy
(),
fallback
:
statedb
.
Copy
(),
nonces
:
make
(
map
[
common
.
Address
]
uint64
),
nonces
:
make
(
map
[
common
.
Address
]
uint64
),
}
}
...
@@ -42,7 +42,7 @@ func newTxNoncer(statedb *state.StateDB) *txNoncer {
...
@@ -42,7 +42,7 @@ func newTxNoncer(statedb *state.StateDB) *txNoncer {
// get returns the current nonce of an account, falling back to a real state
// get returns the current nonce of an account, falling back to a real state
// database if the account is unknown.
// database if the account is unknown.
func
(
txn
*
txN
oncer
)
get
(
addr
common
.
Address
)
uint64
{
func
(
txn
*
n
oncer
)
get
(
addr
common
.
Address
)
uint64
{
// We use mutex for get operation is the underlying
// We use mutex for get operation is the underlying
// state will mutate db even for read access.
// state will mutate db even for read access.
txn
.
lock
.
Lock
()
txn
.
lock
.
Lock
()
...
@@ -58,7 +58,7 @@ func (txn *txNoncer) get(addr common.Address) uint64 {
...
@@ -58,7 +58,7 @@ func (txn *txNoncer) get(addr common.Address) uint64 {
// set inserts a new virtual nonce into the virtual state database to be returned
// set inserts a new virtual nonce into the virtual state database to be returned
// whenever the pool requests it instead of reaching into the real state database.
// whenever the pool requests it instead of reaching into the real state database.
func
(
txn
*
txN
oncer
)
set
(
addr
common
.
Address
,
nonce
uint64
)
{
func
(
txn
*
n
oncer
)
set
(
addr
common
.
Address
,
nonce
uint64
)
{
txn
.
lock
.
Lock
()
txn
.
lock
.
Lock
()
defer
txn
.
lock
.
Unlock
()
defer
txn
.
lock
.
Unlock
()
...
@@ -67,7 +67,7 @@ func (txn *txNoncer) set(addr common.Address, nonce uint64) {
...
@@ -67,7 +67,7 @@ func (txn *txNoncer) set(addr common.Address, nonce uint64) {
// setIfLower updates a new virtual nonce into the virtual state database if the
// setIfLower updates a new virtual nonce into the virtual state database if the
// new one is lower.
// new one is lower.
func
(
txn
*
txN
oncer
)
setIfLower
(
addr
common
.
Address
,
nonce
uint64
)
{
func
(
txn
*
n
oncer
)
setIfLower
(
addr
common
.
Address
,
nonce
uint64
)
{
txn
.
lock
.
Lock
()
txn
.
lock
.
Lock
()
defer
txn
.
lock
.
Unlock
()
defer
txn
.
lock
.
Unlock
()
...
@@ -83,7 +83,7 @@ func (txn *txNoncer) setIfLower(addr common.Address, nonce uint64) {
...
@@ -83,7 +83,7 @@ func (txn *txNoncer) setIfLower(addr common.Address, nonce uint64) {
}
}
// setAll sets the nonces for all accounts to the given map.
// setAll sets the nonces for all accounts to the given map.
func
(
txn
*
txN
oncer
)
setAll
(
all
map
[
common
.
Address
]
uint64
)
{
func
(
txn
*
n
oncer
)
setAll
(
all
map
[
common
.
Address
]
uint64
)
{
txn
.
lock
.
Lock
()
txn
.
lock
.
Lock
()
defer
txn
.
lock
.
Unlock
()
defer
txn
.
lock
.
Unlock
()
...
...
core/tx
_
pool.go
→
core/tx
pool/tx
pool.go
View file @
a6dda036
This diff is collapsed.
Click to expand it.
core/tx
_
pool_test.go
→
core/tx
pool/tx
pool_test.go
View file @
a6dda036
This diff is collapsed.
Click to expand it.
eth/api_backend.go
View file @
a6dda036
...
@@ -30,6 +30,7 @@ import (
...
@@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/core/bloombits"
"github.com/ethereum/go-ethereum/core/bloombits"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/gasprice"
...
@@ -284,7 +285,7 @@ func (b *EthAPIBackend) TxPoolContentFrom(addr common.Address) (types.Transactio
...
@@ -284,7 +285,7 @@ func (b *EthAPIBackend) TxPoolContentFrom(addr common.Address) (types.Transactio
return
b
.
eth
.
TxPool
()
.
ContentFrom
(
addr
)
return
b
.
eth
.
TxPool
()
.
ContentFrom
(
addr
)
}
}
func
(
b
*
EthAPIBackend
)
TxPool
()
*
core
.
TxPool
{
func
(
b
*
EthAPIBackend
)
TxPool
()
*
txpool
.
TxPool
{
return
b
.
eth
.
TxPool
()
return
b
.
eth
.
TxPool
()
}
}
...
...
eth/backend.go
View file @
a6dda036
...
@@ -35,6 +35,7 @@ import (
...
@@ -35,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/core/bloombits"
"github.com/ethereum/go-ethereum/core/bloombits"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state/pruner"
"github.com/ethereum/go-ethereum/core/state/pruner"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/downloader"
...
@@ -66,7 +67,7 @@ type Ethereum struct {
...
@@ -66,7 +67,7 @@ type Ethereum struct {
config
*
ethconfig
.
Config
config
*
ethconfig
.
Config
// Handlers
// Handlers
txPool
*
core
.
TxPool
txPool
*
txpool
.
TxPool
blockchain
*
core
.
BlockChain
blockchain
*
core
.
BlockChain
handler
*
handler
handler
*
handler
ethDialCandidates
enode
.
Iterator
ethDialCandidates
enode
.
Iterator
...
@@ -209,7 +210,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
...
@@ -209,7 +210,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if
config
.
TxPool
.
Journal
!=
""
{
if
config
.
TxPool
.
Journal
!=
""
{
config
.
TxPool
.
Journal
=
stack
.
ResolvePath
(
config
.
TxPool
.
Journal
)
config
.
TxPool
.
Journal
=
stack
.
ResolvePath
(
config
.
TxPool
.
Journal
)
}
}
eth
.
txPool
=
core
.
NewTxPool
(
config
.
TxPool
,
eth
.
blockchain
.
Config
(),
eth
.
blockchain
)
eth
.
txPool
=
txpool
.
NewTxPool
(
config
.
TxPool
,
eth
.
blockchain
.
Config
(),
eth
.
blockchain
)
// Permit the downloader to use the trie cache allowance during fast sync
// Permit the downloader to use the trie cache allowance during fast sync
cacheLimit
:=
cacheConfig
.
TrieCleanLimit
+
cacheConfig
.
TrieDirtyLimit
+
cacheConfig
.
SnapshotLimit
cacheLimit
:=
cacheConfig
.
TrieCleanLimit
+
cacheConfig
.
TrieDirtyLimit
+
cacheConfig
.
SnapshotLimit
...
@@ -482,7 +483,7 @@ func (s *Ethereum) Miner() *miner.Miner { return s.miner }
...
@@ -482,7 +483,7 @@ func (s *Ethereum) Miner() *miner.Miner { return s.miner }
func
(
s
*
Ethereum
)
AccountManager
()
*
accounts
.
Manager
{
return
s
.
accountManager
}
func
(
s
*
Ethereum
)
AccountManager
()
*
accounts
.
Manager
{
return
s
.
accountManager
}
func
(
s
*
Ethereum
)
BlockChain
()
*
core
.
BlockChain
{
return
s
.
blockchain
}
func
(
s
*
Ethereum
)
BlockChain
()
*
core
.
BlockChain
{
return
s
.
blockchain
}
func
(
s
*
Ethereum
)
TxPool
()
*
core
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
Ethereum
)
TxPool
()
*
txpool
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
Ethereum
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
Ethereum
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
Ethereum
)
Engine
()
consensus
.
Engine
{
return
s
.
engine
}
func
(
s
*
Ethereum
)
Engine
()
consensus
.
Engine
{
return
s
.
engine
}
func
(
s
*
Ethereum
)
ChainDb
()
ethdb
.
Database
{
return
s
.
chainDb
}
func
(
s
*
Ethereum
)
ChainDb
()
ethdb
.
Database
{
return
s
.
chainDb
}
...
...
eth/ethconfig/config.go
View file @
a6dda036
...
@@ -31,6 +31,7 @@ import (
...
@@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/clique"
"github.com/ethereum/go-ethereum/consensus/clique"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
...
@@ -85,7 +86,7 @@ var Defaults = Config{
...
@@ -85,7 +86,7 @@ var Defaults = Config{
SnapshotCache
:
102
,
SnapshotCache
:
102
,
FilterLogCacheSize
:
32
,
FilterLogCacheSize
:
32
,
Miner
:
miner
.
DefaultConfig
,
Miner
:
miner
.
DefaultConfig
,
TxPool
:
core
.
DefaultTxPool
Config
,
TxPool
:
txpool
.
Default
Config
,
RPCGasCap
:
50000000
,
RPCGasCap
:
50000000
,
RPCEVMTimeout
:
5
*
time
.
Second
,
RPCEVMTimeout
:
5
*
time
.
Second
,
GPO
:
FullNodeGPO
,
GPO
:
FullNodeGPO
,
...
@@ -178,7 +179,7 @@ type Config struct {
...
@@ -178,7 +179,7 @@ type Config struct {
Ethash
ethash
.
Config
Ethash
ethash
.
Config
// Transaction pool options
// Transaction pool options
TxPool
core
.
TxPool
Config
TxPool
txpool
.
Config
// Gas Price Oracle options
// Gas Price Oracle options
GPO
gasprice
.
Config
GPO
gasprice
.
Config
...
...
eth/ethconfig/gen_config.go
View file @
a6dda036
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/miner"
...
@@ -51,7 +52,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
...
@@ -51,7 +52,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
FilterLogCacheSize
int
FilterLogCacheSize
int
Miner
miner
.
Config
Miner
miner
.
Config
Ethash
ethash
.
Config
Ethash
ethash
.
Config
TxPool
core
.
TxPool
Config
TxPool
txpool
.
Config
GPO
gasprice
.
Config
GPO
gasprice
.
Config
EnablePreimageRecording
bool
EnablePreimageRecording
bool
DocRoot
string
`toml:"-"`
DocRoot
string
`toml:"-"`
...
@@ -147,7 +148,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
...
@@ -147,7 +148,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
FilterLogCacheSize
*
int
FilterLogCacheSize
*
int
Miner
*
miner
.
Config
Miner
*
miner
.
Config
Ethash
*
ethash
.
Config
Ethash
*
ethash
.
Config
TxPool
*
core
.
TxPool
Config
TxPool
*
txpool
.
Config
GPO
*
gasprice
.
Config
GPO
*
gasprice
.
Config
EnablePreimageRecording
*
bool
EnablePreimageRecording
*
bool
DocRoot
*
string
`toml:"-"`
DocRoot
*
string
`toml:"-"`
...
...
eth/fetcher/tx_fetcher.go
View file @
a6dda036
...
@@ -27,7 +27,7 @@ import (
...
@@ -27,7 +27,7 @@ import (
mapset
"github.com/deckarep/golang-set"
mapset
"github.com/deckarep/golang-set"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core
/txpool
"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics"
...
@@ -298,7 +298,7 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool)
...
@@ -298,7 +298,7 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool)
// Track the transaction hash if the price is too low for us.
// Track the transaction hash if the price is too low for us.
// Avoid re-request this transaction when we receive another
// Avoid re-request this transaction when we receive another
// announcement.
// announcement.
if
errors
.
Is
(
err
,
core
.
ErrUnderpriced
)
||
errors
.
Is
(
err
,
core
.
ErrReplaceUnderpriced
)
{
if
errors
.
Is
(
err
,
txpool
.
ErrUnderpriced
)
||
errors
.
Is
(
err
,
txpool
.
ErrReplaceUnderpriced
)
{
for
f
.
underpriced
.
Cardinality
()
>=
maxTxUnderpricedSetSize
{
for
f
.
underpriced
.
Cardinality
()
>=
maxTxUnderpricedSetSize
{
f
.
underpriced
.
Pop
()
f
.
underpriced
.
Pop
()
}
}
...
@@ -308,10 +308,10 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool)
...
@@ -308,10 +308,10 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool)
switch
{
switch
{
case
err
==
nil
:
// Noop, but need to handle to not count these
case
err
==
nil
:
// Noop, but need to handle to not count these
case
errors
.
Is
(
err
,
core
.
ErrAlreadyKnown
)
:
case
errors
.
Is
(
err
,
txpool
.
ErrAlreadyKnown
)
:
duplicate
++
duplicate
++
case
errors
.
Is
(
err
,
core
.
ErrUnderpriced
)
||
errors
.
Is
(
err
,
core
.
ErrReplaceUnderpriced
)
:
case
errors
.
Is
(
err
,
txpool
.
ErrUnderpriced
)
||
errors
.
Is
(
err
,
txpool
.
ErrReplaceUnderpriced
)
:
underpriced
++
underpriced
++
default
:
default
:
...
...
eth/fetcher/tx_fetcher_test.go
View file @
a6dda036
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core
/txpool
"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
)
)
...
@@ -869,9 +869,9 @@ func TestTransactionFetcherUnderpricedDedup(t *testing.T) {
...
@@ -869,9 +869,9 @@ func TestTransactionFetcherUnderpricedDedup(t *testing.T) {
errs
:=
make
([]
error
,
len
(
txs
))
errs
:=
make
([]
error
,
len
(
txs
))
for
i
:=
0
;
i
<
len
(
errs
);
i
++
{
for
i
:=
0
;
i
<
len
(
errs
);
i
++
{
if
i
%
2
==
0
{
if
i
%
2
==
0
{
errs
[
i
]
=
core
.
ErrUnderpriced
errs
[
i
]
=
txpool
.
ErrUnderpriced
}
else
{
}
else
{
errs
[
i
]
=
core
.
ErrReplaceUnderpriced
errs
[
i
]
=
txpool
.
ErrReplaceUnderpriced
}
}
}
}
return
errs
return
errs
...
@@ -941,7 +941,7 @@ func TestTransactionFetcherUnderpricedDoSProtection(t *testing.T) {
...
@@ -941,7 +941,7 @@ func TestTransactionFetcherUnderpricedDoSProtection(t *testing.T) {
func
(
txs
[]
*
types
.
Transaction
)
[]
error
{
func
(
txs
[]
*
types
.
Transaction
)
[]
error
{
errs
:=
make
([]
error
,
len
(
txs
))
errs
:=
make
([]
error
,
len
(
txs
))
for
i
:=
0
;
i
<
len
(
errs
);
i
++
{
for
i
:=
0
;
i
<
len
(
errs
);
i
++
{
errs
[
i
]
=
core
.
ErrUnderpriced
errs
[
i
]
=
txpool
.
ErrUnderpriced
}
}
return
errs
return
errs
},
},
...
...
eth/protocols/eth/handler_test.go
View file @
a6dda036
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
...
@@ -50,7 +51,7 @@ var (
...
@@ -50,7 +51,7 @@ var (
type
testBackend
struct
{
type
testBackend
struct
{
db
ethdb
.
Database
db
ethdb
.
Database
chain
*
core
.
BlockChain
chain
*
core
.
BlockChain
txpool
*
core
.
TxPool
txpool
*
txpool
.
TxPool
}
}
// newTestBackend creates an empty chain and wraps it into a mock backend.
// newTestBackend creates an empty chain and wraps it into a mock backend.
...
@@ -76,13 +77,13 @@ func newTestBackendWithGenerator(blocks int, generator func(int, *core.BlockGen)
...
@@ -76,13 +77,13 @@ func newTestBackendWithGenerator(blocks int, generator func(int, *core.BlockGen)
for
_
,
block
:=
range
bs
{
for
_
,
block
:=
range
bs
{
chain
.
StateCache
()
.
TrieDB
()
.
Commit
(
block
.
Root
(),
false
,
nil
)
chain
.
StateCache
()
.
TrieDB
()
.
Commit
(
block
.
Root
(),
false
,
nil
)
}
}
txconfig
:=
core
.
DefaultTxPool
Config
txconfig
:=
txpool
.
Default
Config
txconfig
.
Journal
=
""
// Don't litter the disk with test journals
txconfig
.
Journal
=
""
// Don't litter the disk with test journals
return
&
testBackend
{
return
&
testBackend
{
db
:
db
,
db
:
db
,
chain
:
chain
,
chain
:
chain
,
txpool
:
core
.
NewTxPool
(
txconfig
,
params
.
TestChainConfig
,
chain
),
txpool
:
txpool
.
NewTxPool
(
txconfig
,
params
.
TestChainConfig
,
chain
),
}
}
}
}
...
...
les/handler_test.go
View file @
a6dda036
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/les/downloader"
"github.com/ethereum/go-ethereum/les/downloader"
...
@@ -624,20 +625,20 @@ func testTransactionStatus(t *testing.T, protocol int) {
...
@@ -624,20 +625,20 @@ func testTransactionStatus(t *testing.T, protocol int) {
// test error status by sending an underpriced transaction
// test error status by sending an underpriced transaction
tx0
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
0
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
nil
,
nil
),
signer
,
bankKey
)
tx0
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
0
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
nil
,
nil
),
signer
,
bankKey
)
test
(
tx0
,
true
,
light
.
TxStatus
{
Status
:
core
.
TxStatusUnknown
,
Error
:
core
.
ErrUnderpriced
.
Error
()})
test
(
tx0
,
true
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusUnknown
,
Error
:
txpool
.
ErrUnderpriced
.
Error
()})
tx1
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
0
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
big
.
NewInt
(
100000000000
),
nil
),
signer
,
bankKey
)
tx1
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
0
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
big
.
NewInt
(
100000000000
),
nil
),
signer
,
bankKey
)
test
(
tx1
,
false
,
light
.
TxStatus
{
Status
:
core
.
TxStatusUnknown
})
// query before sending, should be unknown
test
(
tx1
,
false
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusUnknown
})
// query before sending, should be unknown
test
(
tx1
,
true
,
light
.
TxStatus
{
Status
:
core
.
TxStatusPending
})
// send valid processable tx, should return pending
test
(
tx1
,
true
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusPending
})
// send valid processable tx, should return pending
test
(
tx1
,
true
,
light
.
TxStatus
{
Status
:
core
.
TxStatusPending
})
// adding it again should not return an error
test
(
tx1
,
true
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusPending
})
// adding it again should not return an error
tx2
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
1
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
big
.
NewInt
(
100000000000
),
nil
),
signer
,
bankKey
)
tx2
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
1
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
big
.
NewInt
(
100000000000
),
nil
),
signer
,
bankKey
)
tx3
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
2
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
big
.
NewInt
(
100000000000
),
nil
),
signer
,
bankKey
)
tx3
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
2
,
userAddr1
,
big
.
NewInt
(
10000
),
params
.
TxGas
,
big
.
NewInt
(
100000000000
),
nil
),
signer
,
bankKey
)
// send transactions in the wrong order, tx3 should be queued
// send transactions in the wrong order, tx3 should be queued
test
(
tx3
,
true
,
light
.
TxStatus
{
Status
:
core
.
TxStatusQueued
})
test
(
tx3
,
true
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusQueued
})
test
(
tx2
,
true
,
light
.
TxStatus
{
Status
:
core
.
TxStatusPending
})
test
(
tx2
,
true
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusPending
})
// query again, now tx3 should be pending too
// query again, now tx3 should be pending too
test
(
tx3
,
false
,
light
.
TxStatus
{
Status
:
core
.
TxStatusPending
})
test
(
tx3
,
false
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusPending
})
// generate and add a block with tx1 and tx2 included
// generate and add a block with tx1 and tx2 included
gchain
,
_
:=
core
.
GenerateChain
(
params
.
TestChainConfig
,
chain
.
GetBlockByNumber
(
0
),
ethash
.
NewFaker
(),
server
.
db
,
1
,
func
(
i
int
,
block
*
core
.
BlockGen
)
{
gchain
,
_
:=
core
.
GenerateChain
(
params
.
TestChainConfig
,
chain
.
GetBlockByNumber
(
0
),
ethash
.
NewFaker
(),
server
.
db
,
1
,
func
(
i
int
,
block
*
core
.
BlockGen
)
{
...
@@ -663,9 +664,9 @@ func testTransactionStatus(t *testing.T, protocol int) {
...
@@ -663,9 +664,9 @@ func testTransactionStatus(t *testing.T, protocol int) {
// check if their status is included now
// check if their status is included now
block1hash
:=
rawdb
.
ReadCanonicalHash
(
server
.
db
,
1
)
block1hash
:=
rawdb
.
ReadCanonicalHash
(
server
.
db
,
1
)
test
(
tx1
,
false
,
light
.
TxStatus
{
Status
:
core
.
TxStatusIncluded
,
Lookup
:
&
rawdb
.
LegacyTxLookupEntry
{
BlockHash
:
block1hash
,
BlockIndex
:
1
,
Index
:
0
}})
test
(
tx1
,
false
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusIncluded
,
Lookup
:
&
rawdb
.
LegacyTxLookupEntry
{
BlockHash
:
block1hash
,
BlockIndex
:
1
,
Index
:
0
}})
test
(
tx2
,
false
,
light
.
TxStatus
{
Status
:
core
.
TxStatusIncluded
,
Lookup
:
&
rawdb
.
LegacyTxLookupEntry
{
BlockHash
:
block1hash
,
BlockIndex
:
1
,
Index
:
1
}})
test
(
tx2
,
false
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusIncluded
,
Lookup
:
&
rawdb
.
LegacyTxLookupEntry
{
BlockHash
:
block1hash
,
BlockIndex
:
1
,
Index
:
1
}})
// create a reorg that rolls them back
// create a reorg that rolls them back
gchain
,
_
=
core
.
GenerateChain
(
params
.
TestChainConfig
,
chain
.
GetBlockByNumber
(
0
),
ethash
.
NewFaker
(),
server
.
db
,
2
,
func
(
i
int
,
block
*
core
.
BlockGen
)
{})
gchain
,
_
=
core
.
GenerateChain
(
params
.
TestChainConfig
,
chain
.
GetBlockByNumber
(
0
),
ethash
.
NewFaker
(),
server
.
db
,
2
,
func
(
i
int
,
block
*
core
.
BlockGen
)
{})
...
@@ -687,8 +688,8 @@ func testTransactionStatus(t *testing.T, protocol int) {
...
@@ -687,8 +688,8 @@ func testTransactionStatus(t *testing.T, protocol int) {
msg
.
Discard
()
msg
.
Discard
()
// check if their status is pending again
// check if their status is pending again
test
(
tx1
,
false
,
light
.
TxStatus
{
Status
:
core
.
TxStatusPending
})
test
(
tx1
,
false
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusPending
})
test
(
tx2
,
false
,
light
.
TxStatus
{
Status
:
core
.
TxStatusPending
})
test
(
tx2
,
false
,
light
.
TxStatus
{
Status
:
txpool
.
TxStatusPending
})
}
}
func
TestStopResumeLES3
(
t
*
testing
.
T
)
{
testStopResume
(
t
,
lpv3
)
}
func
TestStopResumeLES3
(
t
*
testing
.
T
)
{
testStopResume
(
t
,
lpv3
)
}
...
...
les/odr.go
View file @
a6dda036
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/light"
"github.com/ethereum/go-ethereum/light"
)
)
...
@@ -176,10 +177,10 @@ func (odr *LesOdr) RetrieveTxStatus(ctx context.Context, req *light.TxStatusRequ
...
@@ -176,10 +177,10 @@ func (odr *LesOdr) RetrieveTxStatus(ctx context.Context, req *light.TxStatusRequ
// All the response is not verifiable, so always pick the first
// All the response is not verifiable, so always pick the first
// one we get.
// one we get.
for
index
,
status
:=
range
req
.
Status
{
for
index
,
status
:=
range
req
.
Status
{
if
result
[
index
]
.
Status
!=
core
.
TxStatusUnknown
{
if
result
[
index
]
.
Status
!=
txpool
.
TxStatusUnknown
{
continue
continue
}
}
if
status
.
Status
==
core
.
TxStatusUnknown
{
if
status
.
Status
==
txpool
.
TxStatusUnknown
{
continue
continue
}
}
result
[
index
],
missing
=
status
,
missing
-
1
result
[
index
],
missing
=
status
,
missing
-
1
...
...
les/odr_test.go
View file @
a6dda036
...
@@ -31,6 +31,7 @@ import (
...
@@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
...
@@ -294,7 +295,7 @@ func testGetTxStatusFromUnindexedPeers(t *testing.T, protocol int) {
...
@@ -294,7 +295,7 @@ func testGetTxStatusFromUnindexedPeers(t *testing.T, protocol int) {
if
testHash
==
(
common
.
Hash
{})
{
if
testHash
==
(
common
.
Hash
{})
{
testHash
=
tx
.
Hash
()
testHash
=
tx
.
Hash
()
testStatus
=
light
.
TxStatus
{
testStatus
=
light
.
TxStatus
{
Status
:
core
.
TxStatusIncluded
,
Status
:
txpool
.
TxStatusIncluded
,
Lookup
:
&
rawdb
.
LegacyTxLookupEntry
{
Lookup
:
&
rawdb
.
LegacyTxLookupEntry
{
BlockHash
:
block
.
Hash
(),
BlockHash
:
block
.
Hash
(),
BlockIndex
:
block
.
NumberU64
(),
BlockIndex
:
block
.
NumberU64
(),
...
@@ -327,7 +328,7 @@ func testGetTxStatusFromUnindexedPeers(t *testing.T, protocol int) {
...
@@ -327,7 +328,7 @@ func testGetTxStatusFromUnindexedPeers(t *testing.T, protocol int) {
if
txLookup
!=
txIndexUnlimited
&&
(
txLookup
==
txIndexDisabled
||
number
<
min
)
{
if
txLookup
!=
txIndexUnlimited
&&
(
txLookup
==
txIndexDisabled
||
number
<
min
)
{
continue
// Filter out unindexed transactions
continue
// Filter out unindexed transactions
}
}
stats
[
i
]
.
Status
=
core
.
TxStatusIncluded
stats
[
i
]
.
Status
=
txpool
.
TxStatusIncluded
stats
[
i
]
.
Lookup
=
&
rawdb
.
LegacyTxLookupEntry
{
stats
[
i
]
.
Lookup
=
&
rawdb
.
LegacyTxLookupEntry
{
BlockHash
:
blockHashes
[
hash
],
BlockHash
:
blockHashes
[
hash
],
BlockIndex
:
number
,
BlockIndex
:
number
,
...
...
les/server.go
View file @
a6dda036
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/les/flowcontrol"
"github.com/ethereum/go-ethereum/les/flowcontrol"
...
@@ -49,7 +50,7 @@ type ethBackend interface {
...
@@ -49,7 +50,7 @@ type ethBackend interface {
BloomIndexer
()
*
core
.
ChainIndexer
BloomIndexer
()
*
core
.
ChainIndexer
ChainDb
()
ethdb
.
Database
ChainDb
()
ethdb
.
Database
Synced
()
bool
Synced
()
bool
TxPool
()
*
core
.
TxPool
TxPool
()
*
txpool
.
TxPool
}
}
type
LesServer
struct
{
type
LesServer
struct
{
...
...
les/server_handler.go
View file @
a6dda036
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/forkid"
"github.com/ethereum/go-ethereum/core/forkid"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/les/flowcontrol"
"github.com/ethereum/go-ethereum/les/flowcontrol"
...
@@ -62,7 +63,7 @@ type serverHandler struct {
...
@@ -62,7 +63,7 @@ type serverHandler struct {
forkFilter
forkid
.
Filter
forkFilter
forkid
.
Filter
blockchain
*
core
.
BlockChain
blockchain
*
core
.
BlockChain
chainDb
ethdb
.
Database
chainDb
ethdb
.
Database
txpool
*
core
.
TxPool
txpool
*
txpool
.
TxPool
server
*
LesServer
server
*
LesServer
closeCh
chan
struct
{}
// Channel used to exit all background routines of handler.
closeCh
chan
struct
{}
// Channel used to exit all background routines of handler.
...
@@ -73,7 +74,7 @@ type serverHandler struct {
...
@@ -73,7 +74,7 @@ type serverHandler struct {
addTxsSync
bool
addTxsSync
bool
}
}
func
newServerHandler
(
server
*
LesServer
,
blockchain
*
core
.
BlockChain
,
chainDb
ethdb
.
Database
,
txpool
*
core
.
TxPool
,
synced
func
()
bool
)
*
serverHandler
{
func
newServerHandler
(
server
*
LesServer
,
blockchain
*
core
.
BlockChain
,
chainDb
ethdb
.
Database
,
txpool
*
txpool
.
TxPool
,
synced
func
()
bool
)
*
serverHandler
{
handler
:=
&
serverHandler
{
handler
:=
&
serverHandler
{
forkFilter
:
forkid
.
NewFilter
(
blockchain
),
forkFilter
:
forkid
.
NewFilter
(
blockchain
),
server
:
server
,
server
:
server
,
...
@@ -343,7 +344,7 @@ func (h *serverHandler) BlockChain() *core.BlockChain {
...
@@ -343,7 +344,7 @@ func (h *serverHandler) BlockChain() *core.BlockChain {
}
}
// TxPool implements serverBackend
// TxPool implements serverBackend
func
(
h
*
serverHandler
)
TxPool
()
*
core
.
TxPool
{
func
(
h
*
serverHandler
)
TxPool
()
*
txpool
.
TxPool
{
return
h
.
txpool
return
h
.
txpool
}
}
...
...
les/server_requests.go
View file @
a6dda036
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/light"
"github.com/ethereum/go-ethereum/light"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
@@ -36,7 +37,7 @@ type serverBackend interface {
...
@@ -36,7 +37,7 @@ type serverBackend interface {
ArchiveMode
()
bool
ArchiveMode
()
bool
AddTxsSync
()
bool
AddTxsSync
()
bool
BlockChain
()
*
core
.
BlockChain
BlockChain
()
*
core
.
BlockChain
TxPool
()
*
core
.
TxPool
TxPool
()
*
txpool
.
TxPool
GetHelperTrie
(
typ
uint
,
index
uint64
)
*
trie
.
Trie
GetHelperTrie
(
typ
uint
,
index
uint64
)
*
trie
.
Trie
}
}
...
@@ -516,7 +517,7 @@ func handleSendTx(msg Decoder) (serveRequestFn, uint64, uint64, error) {
...
@@ -516,7 +517,7 @@ func handleSendTx(msg Decoder) (serveRequestFn, uint64, uint64, error) {
}
}
hash
:=
tx
.
Hash
()
hash
:=
tx
.
Hash
()
stats
[
i
]
=
txStatus
(
backend
,
hash
)
stats
[
i
]
=
txStatus
(
backend
,
hash
)
if
stats
[
i
]
.
Status
==
core
.
TxStatusUnknown
{
if
stats
[
i
]
.
Status
==
txpool
.
TxStatusUnknown
{
addFn
:=
backend
.
TxPool
()
.
AddRemotes
addFn
:=
backend
.
TxPool
()
.
AddRemotes
// Add txs synchronously for testing purpose
// Add txs synchronously for testing purpose
if
backend
.
AddTxsSync
()
{
if
backend
.
AddTxsSync
()
{
...
@@ -558,10 +559,10 @@ func txStatus(b serverBackend, hash common.Hash) light.TxStatus {
...
@@ -558,10 +559,10 @@ func txStatus(b serverBackend, hash common.Hash) light.TxStatus {
stat
.
Status
=
b
.
TxPool
()
.
Status
([]
common
.
Hash
{
hash
})[
0
]
stat
.
Status
=
b
.
TxPool
()
.
Status
([]
common
.
Hash
{
hash
})[
0
]
// If the transaction is unknown to the pool, try looking it up locally.
// If the transaction is unknown to the pool, try looking it up locally.
if
stat
.
Status
==
core
.
TxStatusUnknown
{
if
stat
.
Status
==
txpool
.
TxStatusUnknown
{
lookup
:=
b
.
BlockChain
()
.
GetTransactionLookup
(
hash
)
lookup
:=
b
.
BlockChain
()
.
GetTransactionLookup
(
hash
)
if
lookup
!=
nil
{
if
lookup
!=
nil
{
stat
.
Status
=
core
.
TxStatusIncluded
stat
.
Status
=
txpool
.
TxStatusIncluded
stat
.
Lookup
=
lookup
stat
.
Lookup
=
lookup
}
}
}
}
...
...
les/test_helper.go
View file @
a6dda036
...
@@ -39,6 +39,7 @@ import (
...
@@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/forkid"
"github.com/ethereum/go-ethereum/core/forkid"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/ethconfig"
...
@@ -269,9 +270,9 @@ func newTestServerHandler(blocks int, indexers []*core.ChainIndexer, db ethdb.Da
...
@@ -269,9 +270,9 @@ func newTestServerHandler(blocks int, indexers []*core.ChainIndexer, db ethdb.Da
simulation
:=
backends
.
NewSimulatedBackendWithDatabase
(
db
,
gspec
.
Alloc
,
100000000
)
simulation
:=
backends
.
NewSimulatedBackendWithDatabase
(
db
,
gspec
.
Alloc
,
100000000
)
prepare
(
blocks
,
simulation
)
prepare
(
blocks
,
simulation
)
txpoolConfig
:=
core
.
DefaultTxPool
Config
txpoolConfig
:=
txpool
.
Default
Config
txpoolConfig
.
Journal
=
""
txpoolConfig
.
Journal
=
""
txpool
:=
core
.
NewTxPool
(
txpoolConfig
,
gspec
.
Config
,
simulation
.
Blockchain
())
txpool
:=
txpool
.
NewTxPool
(
txpoolConfig
,
gspec
.
Config
,
simulation
.
Blockchain
())
if
indexers
!=
nil
{
if
indexers
!=
nil
{
checkpointConfig
:=
&
params
.
CheckpointOracleConfig
{
checkpointConfig
:=
&
params
.
CheckpointOracleConfig
{
Address
:
crypto
.
CreateAddress
(
bankAddr
,
0
),
Address
:
crypto
.
CreateAddress
(
bankAddr
,
0
),
...
...
light/odr.go
View file @
a6dda036
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
)
)
...
@@ -182,7 +183,7 @@ func (req *BloomRequest) StoreResult(db ethdb.Database) {
...
@@ -182,7 +183,7 @@ func (req *BloomRequest) StoreResult(db ethdb.Database) {
// TxStatus describes the status of a transaction
// TxStatus describes the status of a transaction
type
TxStatus
struct
{
type
TxStatus
struct
{
Status
core
.
TxStatus
Status
txpool
.
TxStatus
Lookup
*
rawdb
.
LegacyTxLookupEntry
`rlp:"nil"`
Lookup
*
rawdb
.
LegacyTxLookupEntry
`rlp:"nil"`
Error
string
Error
string
}
}
...
...
light/odr_util.go
View file @
a6dda036
...
@@ -23,8 +23,8 @@ import (
...
@@ -23,8 +23,8 @@ import (
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
)
)
...
@@ -277,7 +277,7 @@ func GetBloomBits(ctx context.Context, odr OdrBackend, bit uint, sections []uint
...
@@ -277,7 +277,7 @@ func GetBloomBits(ctx context.Context, odr OdrBackend, bit uint, sections []uint
// number of retries, thus giving a weak guarantee.
// number of retries, thus giving a weak guarantee.
func
GetTransaction
(
ctx
context
.
Context
,
odr
OdrBackend
,
txHash
common
.
Hash
)
(
*
types
.
Transaction
,
common
.
Hash
,
uint64
,
uint64
,
error
)
{
func
GetTransaction
(
ctx
context
.
Context
,
odr
OdrBackend
,
txHash
common
.
Hash
)
(
*
types
.
Transaction
,
common
.
Hash
,
uint64
,
uint64
,
error
)
{
r
:=
&
TxStatusRequest
{
Hashes
:
[]
common
.
Hash
{
txHash
}}
r
:=
&
TxStatusRequest
{
Hashes
:
[]
common
.
Hash
{
txHash
}}
if
err
:=
odr
.
RetrieveTxStatus
(
ctx
,
r
);
err
!=
nil
||
r
.
Status
[
0
]
.
Status
!=
core
.
TxStatusIncluded
{
if
err
:=
odr
.
RetrieveTxStatus
(
ctx
,
r
);
err
!=
nil
||
r
.
Status
[
0
]
.
Status
!=
txpool
.
TxStatusIncluded
{
return
nil
,
common
.
Hash
{},
0
,
0
,
err
return
nil
,
common
.
Hash
{},
0
,
0
,
err
}
}
pos
:=
r
.
Status
[
0
]
.
Lookup
pos
:=
r
.
Status
[
0
]
.
Lookup
...
...
light/txpool.go
View file @
a6dda036
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
...
@@ -354,7 +355,7 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
...
@@ -354,7 +355,7 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
// Validate the transaction sender and it's sig. Throw
// Validate the transaction sender and it's sig. Throw
// if the from fields is invalid.
// if the from fields is invalid.
if
from
,
err
=
types
.
Sender
(
pool
.
signer
,
tx
);
err
!=
nil
{
if
from
,
err
=
types
.
Sender
(
pool
.
signer
,
tx
);
err
!=
nil
{
return
core
.
ErrInvalidSender
return
txpool
.
ErrInvalidSender
}
}
// Last but not least check for nonce errors
// Last but not least check for nonce errors
currentState
:=
pool
.
currentState
(
ctx
)
currentState
:=
pool
.
currentState
(
ctx
)
...
@@ -366,14 +367,14 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
...
@@ -366,14 +367,14 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
// block limit gas.
// block limit gas.
header
:=
pool
.
chain
.
GetHeaderByHash
(
pool
.
head
)
header
:=
pool
.
chain
.
GetHeaderByHash
(
pool
.
head
)
if
header
.
GasLimit
<
tx
.
Gas
()
{
if
header
.
GasLimit
<
tx
.
Gas
()
{
return
core
.
ErrGasLimit
return
txpool
.
ErrGasLimit
}
}
// Transactions can't be negative. This may never happen
// Transactions can't be negative. This may never happen
// using RLP decoded transactions but may occur if you create
// using RLP decoded transactions but may occur if you create
// a transaction using the RPC for example.
// a transaction using the RPC for example.
if
tx
.
Value
()
.
Sign
()
<
0
{
if
tx
.
Value
()
.
Sign
()
<
0
{
return
core
.
ErrNegativeValue
return
txpool
.
ErrNegativeValue
}
}
// Transactor should have enough funds to cover the costs
// Transactor should have enough funds to cover the costs
...
...
miner/miner.go
View file @
a6dda036
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
...
@@ -39,7 +40,7 @@ import (
...
@@ -39,7 +40,7 @@ import (
// to offer all the functions here.
// to offer all the functions here.
type
Backend
interface
{
type
Backend
interface
{
BlockChain
()
*
core
.
BlockChain
BlockChain
()
*
core
.
BlockChain
TxPool
()
*
core
.
TxPool
TxPool
()
*
txpool
.
TxPool
}
}
// Config is the configuration parameters of mining.
// Config is the configuration parameters of mining.
...
...
miner/miner_test.go
View file @
a6dda036
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/downloader"
...
@@ -37,10 +38,10 @@ import (
...
@@ -37,10 +38,10 @@ import (
type
mockBackend
struct
{
type
mockBackend
struct
{
bc
*
core
.
BlockChain
bc
*
core
.
BlockChain
txPool
*
core
.
TxPool
txPool
*
txpool
.
TxPool
}
}
func
NewMockBackend
(
bc
*
core
.
BlockChain
,
txPool
*
core
.
TxPool
)
*
mockBackend
{
func
NewMockBackend
(
bc
*
core
.
BlockChain
,
txPool
*
txpool
.
TxPool
)
*
mockBackend
{
return
&
mockBackend
{
return
&
mockBackend
{
bc
:
bc
,
bc
:
bc
,
txPool
:
txPool
,
txPool
:
txPool
,
...
@@ -51,7 +52,7 @@ func (m *mockBackend) BlockChain() *core.BlockChain {
...
@@ -51,7 +52,7 @@ func (m *mockBackend) BlockChain() *core.BlockChain {
return
m
.
bc
return
m
.
bc
}
}
func
(
m
*
mockBackend
)
TxPool
()
*
core
.
TxPool
{
func
(
m
*
mockBackend
)
TxPool
()
*
txpool
.
TxPool
{
return
m
.
txPool
return
m
.
txPool
}
}
...
@@ -263,7 +264,7 @@ func createMiner(t *testing.T) (*Miner, *event.TypeMux, func(skipMiner bool)) {
...
@@ -263,7 +264,7 @@ func createMiner(t *testing.T) (*Miner, *event.TypeMux, func(skipMiner bool)) {
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
chainDB
),
nil
)
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
chainDB
),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
10000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
statedb
,
10000000
,
new
(
event
.
Feed
)}
pool
:=
core
.
NewTxPool
(
testTxPoolConfig
,
chainConfig
,
blockchain
)
pool
:=
txpool
.
NewTxPool
(
testTxPoolConfig
,
chainConfig
,
blockchain
)
backend
:=
NewMockBackend
(
bc
,
pool
)
backend
:=
NewMockBackend
(
bc
,
pool
)
// Create event Mux
// Create event Mux
mux
:=
new
(
event
.
TypeMux
)
mux
:=
new
(
event
.
TypeMux
)
...
...
miner/stress/1559/main.go
View file @
a6dda036
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
...
@@ -245,7 +246,7 @@ func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
...
@@ -245,7 +246,7 @@ func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
SyncMode
:
downloader
.
FullSync
,
SyncMode
:
downloader
.
FullSync
,
DatabaseCache
:
256
,
DatabaseCache
:
256
,
DatabaseHandles
:
256
,
DatabaseHandles
:
256
,
TxPool
:
core
.
DefaultTxPool
Config
,
TxPool
:
txpool
.
Default
Config
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Miner
:
miner
.
Config
{
Miner
:
miner
.
Config
{
...
...
miner/stress/beacon/main.go
View file @
a6dda036
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/beacon"
"github.com/ethereum/go-ethereum/core/beacon"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
...
@@ -484,7 +485,7 @@ func makeFullNode(genesis *core.Genesis) (*node.Node, *eth.Ethereum, *ethcatalys
...
@@ -484,7 +485,7 @@ func makeFullNode(genesis *core.Genesis) (*node.Node, *eth.Ethereum, *ethcatalys
SyncMode
:
downloader
.
FullSync
,
SyncMode
:
downloader
.
FullSync
,
DatabaseCache
:
256
,
DatabaseCache
:
256
,
DatabaseHandles
:
256
,
DatabaseHandles
:
256
,
TxPool
:
core
.
DefaultTxPool
Config
,
TxPool
:
txpool
.
Default
Config
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Miner
:
miner
.
Config
{
Miner
:
miner
.
Config
{
...
@@ -535,7 +536,7 @@ func makeLightNode(genesis *core.Genesis) (*node.Node, *les.LightEthereum, *lesc
...
@@ -535,7 +536,7 @@ func makeLightNode(genesis *core.Genesis) (*node.Node, *les.LightEthereum, *lesc
SyncMode
:
downloader
.
LightSync
,
SyncMode
:
downloader
.
LightSync
,
DatabaseCache
:
256
,
DatabaseCache
:
256
,
DatabaseHandles
:
256
,
DatabaseHandles
:
256
,
TxPool
:
core
.
DefaultTxPool
Config
,
TxPool
:
txpool
.
Default
Config
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
LightPeers
:
10
,
LightPeers
:
10
,
...
...
miner/stress/clique/main.go
View file @
a6dda036
...
@@ -30,6 +30,7 @@ import (
...
@@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
...
@@ -206,7 +207,7 @@ func makeSealer(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
...
@@ -206,7 +207,7 @@ func makeSealer(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
SyncMode
:
downloader
.
FullSync
,
SyncMode
:
downloader
.
FullSync
,
DatabaseCache
:
256
,
DatabaseCache
:
256
,
DatabaseHandles
:
256
,
DatabaseHandles
:
256
,
TxPool
:
core
.
DefaultTxPool
Config
,
TxPool
:
txpool
.
Default
Config
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
Miner
:
miner
.
Config
{
Miner
:
miner
.
Config
{
GasCeil
:
genesis
.
GasLimit
*
11
/
10
,
GasCeil
:
genesis
.
GasLimit
*
11
/
10
,
...
...
miner/stress/ethash/main.go
View file @
a6dda036
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
...
@@ -175,7 +176,7 @@ func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
...
@@ -175,7 +176,7 @@ func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
SyncMode
:
downloader
.
FullSync
,
SyncMode
:
downloader
.
FullSync
,
DatabaseCache
:
256
,
DatabaseCache
:
256
,
DatabaseHandles
:
256
,
DatabaseHandles
:
256
,
TxPool
:
core
.
DefaultTxPool
Config
,
TxPool
:
txpool
.
Default
Config
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
GPO
:
ethconfig
.
Defaults
.
GPO
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Ethash
:
ethconfig
.
Defaults
.
Ethash
,
Miner
:
miner
.
Config
{
Miner
:
miner
.
Config
{
...
...
miner/worker.go
View file @
a6dda036
...
@@ -917,7 +917,7 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
...
@@ -917,7 +917,7 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
env
.
tcount
++
env
.
tcount
++
txs
.
Shift
()
txs
.
Shift
()
case
errors
.
Is
(
err
,
core
.
ErrTxTypeNotSupported
)
:
case
errors
.
Is
(
err
,
types
.
ErrTxTypeNotSupported
)
:
// Pop the unsupported transaction without shifting in the next from the account
// Pop the unsupported transaction without shifting in the next from the account
log
.
Trace
(
"Skipping unsupported transaction type"
,
"sender"
,
from
,
"type"
,
tx
.
Type
())
log
.
Trace
(
"Skipping unsupported transaction type"
,
"sender"
,
from
,
"type"
,
tx
.
Type
())
txs
.
Pop
()
txs
.
Pop
()
...
...
miner/worker_test.go
View file @
a6dda036
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
...
@@ -51,7 +52,7 @@ const (
...
@@ -51,7 +52,7 @@ const (
var
(
var
(
// Test chain configurations
// Test chain configurations
testTxPoolConfig
core
.
TxPool
Config
testTxPoolConfig
txpool
.
Config
ethashChainConfig
*
params
.
ChainConfig
ethashChainConfig
*
params
.
ChainConfig
cliqueChainConfig
*
params
.
ChainConfig
cliqueChainConfig
*
params
.
ChainConfig
...
@@ -74,7 +75,7 @@ var (
...
@@ -74,7 +75,7 @@ var (
)
)
func
init
()
{
func
init
()
{
testTxPoolConfig
=
core
.
DefaultTxPool
Config
testTxPoolConfig
=
txpool
.
Default
Config
testTxPoolConfig
.
Journal
=
""
testTxPoolConfig
.
Journal
=
""
ethashChainConfig
=
new
(
params
.
ChainConfig
)
ethashChainConfig
=
new
(
params
.
ChainConfig
)
*
ethashChainConfig
=
*
params
.
TestChainConfig
*
ethashChainConfig
=
*
params
.
TestChainConfig
...
@@ -111,7 +112,7 @@ func init() {
...
@@ -111,7 +112,7 @@ func init() {
// testWorkerBackend implements worker.Backend interfaces and wraps all information needed during the testing.
// testWorkerBackend implements worker.Backend interfaces and wraps all information needed during the testing.
type
testWorkerBackend
struct
{
type
testWorkerBackend
struct
{
db
ethdb
.
Database
db
ethdb
.
Database
txPool
*
core
.
TxPool
txPool
*
txpool
.
TxPool
chain
*
core
.
BlockChain
chain
*
core
.
BlockChain
genesis
*
core
.
Genesis
genesis
*
core
.
Genesis
uncleBlock
*
types
.
Block
uncleBlock
*
types
.
Block
...
@@ -134,7 +135,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
...
@@ -134,7 +135,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
t
.
Fatalf
(
"unexpected consensus engine type: %T"
,
engine
)
t
.
Fatalf
(
"unexpected consensus engine type: %T"
,
engine
)
}
}
chain
,
_
:=
core
.
NewBlockChain
(
db
,
&
core
.
CacheConfig
{
TrieDirtyDisabled
:
true
},
gspec
,
nil
,
engine
,
vm
.
Config
{},
nil
,
nil
)
chain
,
_
:=
core
.
NewBlockChain
(
db
,
&
core
.
CacheConfig
{
TrieDirtyDisabled
:
true
},
gspec
,
nil
,
engine
,
vm
.
Config
{},
nil
,
nil
)
txpool
:=
core
.
NewTxPool
(
testTxPoolConfig
,
chainConfig
,
chain
)
txpool
:=
txpool
.
NewTxPool
(
testTxPoolConfig
,
chainConfig
,
chain
)
// Generate a small n-block chain and an uncle block for it
// Generate a small n-block chain and an uncle block for it
var
uncle
*
types
.
Block
var
uncle
*
types
.
Block
...
@@ -166,7 +167,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
...
@@ -166,7 +167,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine
}
}
func
(
b
*
testWorkerBackend
)
BlockChain
()
*
core
.
BlockChain
{
return
b
.
chain
}
func
(
b
*
testWorkerBackend
)
BlockChain
()
*
core
.
BlockChain
{
return
b
.
chain
}
func
(
b
*
testWorkerBackend
)
TxPool
()
*
core
.
TxPool
{
return
b
.
txPool
}
func
(
b
*
testWorkerBackend
)
TxPool
()
*
txpool
.
TxPool
{
return
b
.
txPool
}
func
(
b
*
testWorkerBackend
)
StateAtBlock
(
block
*
types
.
Block
,
reexec
uint64
,
base
*
state
.
StateDB
,
checkLive
bool
,
preferDisk
bool
)
(
statedb
*
state
.
StateDB
,
err
error
)
{
func
(
b
*
testWorkerBackend
)
StateAtBlock
(
block
*
types
.
Block
,
reexec
uint64
,
base
*
state
.
StateDB
,
checkLive
bool
,
preferDisk
bool
)
(
statedb
*
state
.
StateDB
,
err
error
)
{
return
nil
,
errors
.
New
(
"not supported"
)
return
nil
,
errors
.
New
(
"not supported"
)
}
}
...
...
tests/fuzzers/les/les-fuzzer.go
View file @
a6dda036
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
...
@@ -111,7 +112,7 @@ func init() {
...
@@ -111,7 +112,7 @@ func init() {
type
fuzzer
struct
{
type
fuzzer
struct
{
chain
*
core
.
BlockChain
chain
*
core
.
BlockChain
pool
*
core
.
TxPool
pool
*
txpool
.
TxPool
chainLen
int
chainLen
int
addr
,
txs
[]
common
.
Hash
addr
,
txs
[]
common
.
Hash
...
@@ -137,7 +138,7 @@ func newFuzzer(input []byte) *fuzzer {
...
@@ -137,7 +138,7 @@ func newFuzzer(input []byte) *fuzzer {
chtKeys
:
chtKeys
,
chtKeys
:
chtKeys
,
bloomKeys
:
bloomKeys
,
bloomKeys
:
bloomKeys
,
nonce
:
uint64
(
len
(
txHashes
)),
nonce
:
uint64
(
len
(
txHashes
)),
pool
:
core
.
NewTxPool
(
core
.
DefaultTxPool
Config
,
params
.
TestChainConfig
,
chain
),
pool
:
txpool
.
NewTxPool
(
txpool
.
Default
Config
,
params
.
TestChainConfig
,
chain
),
input
:
bytes
.
NewReader
(
input
),
input
:
bytes
.
NewReader
(
input
),
}
}
}
}
...
@@ -229,7 +230,7 @@ func (f *fuzzer) BlockChain() *core.BlockChain {
...
@@ -229,7 +230,7 @@ func (f *fuzzer) BlockChain() *core.BlockChain {
return
f
.
chain
return
f
.
chain
}
}
func
(
f
*
fuzzer
)
TxPool
()
*
core
.
TxPool
{
func
(
f
*
fuzzer
)
TxPool
()
*
txpool
.
TxPool
{
return
f
.
pool
return
f
.
pool
}
}
...
...
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