simplify calculations in state_transition.go; add guards and derive gasPrice in TxPool.validateTx

This commit is contained in:
Ian Norden
2020-07-03 14:26:02 -05:00
parent 9c33f94f40
commit ebc57346b0
+2 -2
View File
@@ -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{})
}