diff options
author | bojie <bojie@dexon.org> | 2019-03-18 23:55:32 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:23 +0800 |
commit | b8bcab7f7321eab5a5f29ae058bd05640b0da1c7 (patch) | |
tree | 827b1e9829de70b9d9f089ce07845dd5d813b708 /dex/app.go | |
parent | 00c39b0266a86061b06fe53114aa61b8d946301f (diff) | |
download | go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.tar go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.tar.gz go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.tar.bz2 go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.tar.lz go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.tar.xz go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.tar.zst go-tangerine-b8bcab7f7321eab5a5f29ae058bd05640b0da1c7.zip |
app: validate gas price while preparing block (#274)
Skip tx which is under price and add test case.
Use the key which has balance in test case to run test more correctly.
Diffstat (limited to 'dex/app.go')
-rw-r--r-- | dex/app.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dex/app.go b/dex/app.go index d82d46658..3f580f12e 100644 --- a/dex/app.go +++ b/dex/app.go @@ -181,6 +181,7 @@ func (d *DexconApp) preparePayload(ctx context.Context, position coreTypes.Posit } blockGasLimit := new(big.Int).SetUint64(d.gov.DexconConfiguration(position.Round).BlockGasLimit) + minGasPrice := d.gov.DexconConfiguration(position.Round).MinGasPrice blockGasUsed := new(big.Int) allTxs := make([]*types.Transaction, 0, 10000) @@ -216,6 +217,11 @@ addressMap: // Warning: the pending tx will also affect by syncing, so startIndex maybe negative for i := startIndex; i >= 0 && i < len(txs); i++ { tx := txs[i] + if minGasPrice.Cmp(tx.GasPrice()) > 0 { + log.Error("Invalid gas price minGas(%v) > get(%v)", minGasPrice, tx.GasPrice()) + break + } + intrGas, err := core.IntrinsicGas(tx.Data(), tx.To() == nil, true) if err != nil { log.Error("Failed to calculate intrinsic gas", "error", err) |