mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core, light: address comments
This commit is contained in:
parent
acad1475e6
commit
80bb52c244
2 changed files with 6 additions and 18 deletions
|
|
@ -217,8 +217,7 @@ type TxPool struct {
|
|||
signer types.Signer
|
||||
mu sync.RWMutex
|
||||
|
||||
homestead bool // Fork indicator whether we are in the homestead stage.
|
||||
istanbul bool // Fork indicator whether we are in the istanbul stage.
|
||||
istanbul bool // Fork indicator whether we are in the istanbul stage.
|
||||
|
||||
currentState *state.StateDB // Current state in the blockchain head
|
||||
pendingNonces *txNoncer // Pending state tracking virtual nonces
|
||||
|
|
@ -543,7 +542,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
|
|||
return ErrInsufficientFunds
|
||||
}
|
||||
// Ensure the transaction has more gas than the basic tx fee.
|
||||
intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead, pool.istanbul)
|
||||
intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, true, pool.istanbul)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1122,14 +1121,9 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
|
|||
senderCacher.recover(pool.signer, reinject)
|
||||
pool.addTxsLocked(reinject, false)
|
||||
|
||||
// Update all fork indicators by next pending block number.
|
||||
// Update all fork indicator by next pending block number.
|
||||
next := new(big.Int).Add(newHead.Number, big.NewInt(1))
|
||||
pool.istanbul = pool.chainconfig.IsIstanbul(next)
|
||||
if pool.istanbul {
|
||||
pool.homestead = true
|
||||
} else {
|
||||
pool.homestead = pool.chainconfig.IsHomestead(next)
|
||||
}
|
||||
}
|
||||
|
||||
// promoteExecutables moves transactions that have become processable from the
|
||||
|
|
|
|||
|
|
@ -68,8 +68,7 @@ type TxPool struct {
|
|||
mined map[common.Hash][]*types.Transaction // mined transactions by block hash
|
||||
clearIdx uint64 // earliest block nr that can contain mined tx info
|
||||
|
||||
homestead bool // Fork indicator whether we are in the homestead stage.
|
||||
istanbul bool // Fork indicator whether we are in the istanbul stage.
|
||||
istanbul bool // Fork indicator whether we are in the istanbul stage.
|
||||
}
|
||||
|
||||
// TxRelayBackend provides an interface to the mechanism that forwards transacions
|
||||
|
|
@ -312,14 +311,9 @@ func (pool *TxPool) setNewHead(head *types.Header) {
|
|||
m, r := txc.getLists()
|
||||
pool.relay.NewHead(pool.head, m, r)
|
||||
|
||||
// Update fork indicators by next pending block number
|
||||
// Update fork indicator by next pending block number
|
||||
next := new(big.Int).Add(head.Number, big.NewInt(1))
|
||||
pool.istanbul = pool.config.IsIstanbul(next)
|
||||
if pool.istanbul {
|
||||
pool.homestead = true
|
||||
} else {
|
||||
pool.homestead = pool.config.IsHomestead(next)
|
||||
}
|
||||
}
|
||||
|
||||
// Stop stops the light transaction pool
|
||||
|
|
@ -387,7 +381,7 @@ func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error
|
|||
}
|
||||
|
||||
// Should supply enough intrinsic gas
|
||||
gas, err := core.IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead, pool.istanbul)
|
||||
gas, err := core.IntrinsicGas(tx.Data(), tx.To() == nil, true, pool.istanbul)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue