From c2c4c9f1e5f887058285c1299d250899fe0f7d89 Mon Sep 17 00:00:00 2001 From: gary rong Date: Wed, 14 Aug 2019 20:53:21 +0800 Subject: core, light, params: implement eip2028 (#19931) * core, light, params: implement eip2028 * core, light: address comments * core: address comments * tests: disable Istanbul tx tests (until updated) * core: address comment --- light/txpool.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'light') diff --git a/light/txpool.go b/light/txpool.go index e945ef2ec..11a0e76ae 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -19,6 +19,7 @@ package light import ( "context" "fmt" + "math/big" "sync" "time" @@ -67,7 +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 + istanbul bool // Fork indicator whether we are in the istanbul stage. } // TxRelayBackend provides an interface to the mechanism that forwards transacions @@ -309,8 +310,10 @@ func (pool *TxPool) setNewHead(head *types.Header) { txc, _ := pool.reorgOnNewHead(ctx, head) m, r := txc.getLists() pool.relay.NewHead(pool.head, m, r) - pool.homestead = pool.config.IsHomestead(head.Number) - pool.signer = types.MakeSigner(pool.config, head.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) } // Stop stops the light transaction pool @@ -378,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) + gas, err := core.IntrinsicGas(tx.Data(), tx.To() == nil, true, pool.istanbul) if err != nil { return err } -- cgit v1.2.3