mirror of https://github.com/poanetwork/quorum.git
Merge pull request #680 from jpmorganchase/fix/raft-calcgaslimit
raft: pass gas floor and gas ceil to calcGasLimit when minting block
This commit is contained in:
commit
1c07c0c8c4
|
@ -557,3 +557,7 @@ func (s *Ethereum) Stop() error {
|
|||
close(s.shutdownChan)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Ethereum) CalcGasLimit(block *types.Block) uint64 {
|
||||
return core.CalcGasLimit(block, s.config.MinerGasFloor, s.config.MinerGasCeil)
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ var DefaultConfig = Config{
|
|||
DatabaseCache: 768,
|
||||
TrieCache: 256,
|
||||
TrieTimeout: 60 * time.Minute,
|
||||
MinerGasFloor: 8000000,
|
||||
MinerGasCeil: 8000000,
|
||||
MinerGasFloor: params.MinGasLimit,
|
||||
MinerGasCeil: params.GenesisGasLimit,
|
||||
MinerGasPrice: big.NewInt(params.GWei),
|
||||
MinerRecommit: 3 * time.Second,
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
|
@ -31,21 +33,23 @@ type RaftService struct {
|
|||
startPeers []*enode.Node
|
||||
|
||||
// we need an event mux to instantiate the blockchain
|
||||
eventMux *event.TypeMux
|
||||
minter *minter
|
||||
nodeKey *ecdsa.PrivateKey
|
||||
eventMux *event.TypeMux
|
||||
minter *minter
|
||||
nodeKey *ecdsa.PrivateKey
|
||||
calcGasLimitFunc func(block *types.Block) uint64
|
||||
}
|
||||
|
||||
func New(ctx *node.ServiceContext, chainConfig *params.ChainConfig, raftId, raftPort uint16, joinExisting bool, blockTime time.Duration, e *eth.Ethereum, startPeers []*enode.Node, datadir string) (*RaftService, error) {
|
||||
service := &RaftService{
|
||||
eventMux: ctx.EventMux,
|
||||
chainDb: e.ChainDb(),
|
||||
blockchain: e.BlockChain(),
|
||||
txPool: e.TxPool(),
|
||||
accountManager: e.AccountManager(),
|
||||
downloader: e.Downloader(),
|
||||
startPeers: startPeers,
|
||||
nodeKey: ctx.NodeKey(),
|
||||
eventMux: ctx.EventMux,
|
||||
chainDb: e.ChainDb(),
|
||||
blockchain: e.BlockChain(),
|
||||
txPool: e.TxPool(),
|
||||
accountManager: e.AccountManager(),
|
||||
downloader: e.Downloader(),
|
||||
startPeers: startPeers,
|
||||
nodeKey: ctx.NodeKey(),
|
||||
calcGasLimitFunc: e.CalcGasLimit,
|
||||
}
|
||||
|
||||
service.minter = newMinter(chainConfig, service, blockTime)
|
||||
|
|
|
@ -262,7 +262,7 @@ func (minter *minter) createWork() *work {
|
|||
ParentHash: parent.Hash(),
|
||||
Number: parentNumber.Add(parentNumber, common.Big1),
|
||||
Difficulty: ethash.CalcDifficulty(minter.config, uint64(tstamp), parent.Header()),
|
||||
GasLimit: core.CalcGasLimit(parent, parent.GasLimit(), parent.GasLimit()),
|
||||
GasLimit: minter.eth.calcGasLimitFunc(parent),
|
||||
GasUsed: 0,
|
||||
Coinbase: minter.coinbase,
|
||||
Time: big.NewInt(tstamp),
|
||||
|
|
Loading…
Reference in New Issue