Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ func (p *TxPool) Get(hash common.Hash) *types.Transaction {

// GetRLP returns a RLP-encoded transaction if it is contained in the pool.
func (p *TxPool) GetRLP(hash common.Hash) []byte {
if p == nil {
return nil
}
for _, subpool := range p.subpools {
encoded := subpool.GetRLP(hash)
if len(encoded) != 0 {
Expand All @@ -312,6 +315,9 @@ func (p *TxPool) GetRLP(hash common.Hash) []byte {
// GetMetadata returns the transaction type and transaction size with the given
// hash.
func (p *TxPool) GetMetadata(hash common.Hash) *TxMetadata {
if p == nil {
return nil
}
for _, subpool := range p.subpools {
if meta := subpool.GetMetadata(hash); meta != nil {
return meta
Expand Down Expand Up @@ -425,6 +431,9 @@ func (p *TxPool) PoolNonce(addr common.Address) uint64 {
// Nonce returns the next nonce of an account at the current chain head. Unlike
// PoolNonce, this function does not account for pending executable transactions.
func (p *TxPool) Nonce(addr common.Address) uint64 {
if p == nil {
return 0
}
p.stateLock.RLock()
defer p.stateLock.RUnlock()

Expand All @@ -450,6 +459,9 @@ func (p *TxPool) Stats() (int, int) {
// Content retrieves the data content of the transaction pool, returning all the
// pending as well as queued transactions, grouped by account and sorted by nonce.
func (p *TxPool) Content() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) {
if p == nil {
return make(map[common.Address][]*types.Transaction), make(map[common.Address][]*types.Transaction)
}
var (
runnable = make(map[common.Address][]*types.Transaction)
blocked = make(map[common.Address][]*types.Transaction)
Expand All @@ -470,6 +482,9 @@ func (p *TxPool) Content() (map[common.Address][]*types.Transaction, map[common.
// ContentFrom retrieves the data content of the transaction pool, returning the
// pending as well as queued transactions of this address, grouped by nonce.
func (p *TxPool) ContentFrom(addr common.Address) ([]*types.Transaction, []*types.Transaction) {
if p == nil {
return []*types.Transaction{}, []*types.Transaction{}
}
for _, subpool := range p.subpools {
run, block := subpool.ContentFrom(addr)
if len(run) != 0 || len(block) != 0 {
Expand Down
4 changes: 0 additions & 4 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
eth.txPool.SetGasTip(new(big.Int).SetUint64(params.BorDefaultTxPoolPriceLimit))
}

// The `config.TxPool.PriceLimit` used above doesn't reflect the sanitized/enforced changes
// made in the txpool. Update the `gasTip` explicitly to reflect the enforced value.
eth.txPool.SetGasTip(new(big.Int).SetUint64(params.BorDefaultTxPoolPriceLimit))
Comment thread
cffls marked this conversation as resolved.

if !config.TxPool.NoLocals {
rejournal := config.TxPool.Rejournal
if rejournal < time.Second {
Expand Down
Loading