• Jeffrey Wilcke's avatar
    core, core/vm: added gas price variance table · 64af2aaf
    Jeffrey Wilcke authored
    This implements 1b & 1c of EIP150 by adding a new GasTable which must be
    returned from the RuleSet config method. This table is used to determine
    the gas prices for the current epoch.
    
    Please note that when the CreateBySuicide gas price is set it is assumed
    that we're in the new epoch phase.
    
    In addition this PR will serve as temporary basis while refactorisation
    in being done in the EVM64 PR, which will substentially overhaul the gas
    price code.
    64af2aaf
util_test.go 1.05 KB
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package vm

import (
	"math/big"

	"github.com/ethereum/go-ethereum/params"
)

type ruleSet struct {
	hs *big.Int
}

func (r ruleSet) IsHomestead(n *big.Int) bool { return n.Cmp(r.hs) >= 0 }
func (r ruleSet) GasTable(*big.Int) params.GasTable {
	return params.GasTableHomestead
}