simplify calculations in state_transition.go; add guards and derive gasPrice in TxPool.validateTx
This commit is contained in:
@@ -52,7 +52,7 @@ type BlockGen struct {
|
||||
// SetCoinbase sets the coinbase of the generated block.
|
||||
// It can be called at most once.
|
||||
func (b *BlockGen) SetCoinbase(addr common.Address) {
|
||||
if b.gasPool != nil || b.gasPool1559 != nil {
|
||||
if b.gasPool != nil {
|
||||
if len(b.txs) > 0 {
|
||||
panic("coinbase must be set before adding transactions")
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func (b *BlockGen) AddTx(tx *types.Transaction) {
|
||||
// added. If contract code relies on the BLOCKHASH instruction,
|
||||
// the block in chain will be returned.
|
||||
func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
|
||||
if b.gasPool == nil || b.gasPool1559 == nil {
|
||||
if b.gasPool == nil {
|
||||
b.SetCoinbase(common.Address{})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user