aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/block.go
diff options
context:
space:
mode:
authorTyler Smith <tylersmith.me@gmail.com>2020-07-30 22:00:38 -0700
committerTyler Smith <tylersmith.me@gmail.com>2020-08-12 03:07:00 -0700
commit14fe03cbfecf508848bcd1172ea8d2ee3e41fda4 (patch)
tree6282fdea776271c1c141c5ca8560846dbea60252 /plugin/evm/block.go
parent1bb314f767785fe617c3c5efeca1a64127339506 (diff)
TWEAK: Set minimum gas price.
Diffstat (limited to 'plugin/evm/block.go')
-rw-r--r--plugin/evm/block.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugin/evm/block.go b/plugin/evm/block.go
index 449e261..1a2bf9e 100644
--- a/plugin/evm/block.go
+++ b/plugin/evm/block.go
@@ -61,6 +61,15 @@ func (b *Block) Parent() snowman.Block {
// Verify implements the snowman.Block interface
func (b *Block) Verify() error {
+ // Ensure the minimum gas price is paid for every transaction
+ for _, tx := range b.ethBlock.Transactions() {
+ if tx.GasPrice().Cmp(minGasPrice) < 0 {
+ return errInvalidBlock
+ }
+ }
+
+ // Attempt to add the block to the chain and consider the block valid iff it's
+ // accepted
_, err := b.vm.chain.InsertChain([]*types.Block{b.ethBlock})
return err
}