aboutsummaryrefslogtreecommitdiffstats
path: root/light
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2019-08-14 20:53:21 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-08-14 20:53:21 +0800
commitc2c4c9f1e5f887058285c1299d250899fe0f7d89 (patch)
tree75bf202494ff70905f0c67e56b0840e615979c1e /light
parent44c8b9ad373dd99d4a92d6e5de63a7e7354bd850 (diff)
downloadgo-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.tar
go-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.tar.gz
go-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.tar.bz2
go-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.tar.lz
go-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.tar.xz
go-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.tar.zst
go-tangerine-c2c4c9f1e5f887058285c1299d250899fe0f7d89.zip
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
Diffstat (limited to 'light')
-rw-r--r--light/txpool.go11
1 files changed, 7 insertions, 4 deletions
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
}