mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
Merge pull request #343 from dinhln89/half-mn
Fixed only three MNs making block when --tomo-testnet flag enable.
This commit is contained in:
commit
4fce319988
5 changed files with 20 additions and 2 deletions
|
|
@ -36,6 +36,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/params"
|
||||
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
||||
"github.com/naoina/toml"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -151,6 +152,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, tomoConfig) {
|
|||
ctx.Set(utils.NATFlag.Name, cfg.NAT)
|
||||
}
|
||||
|
||||
// Check testnet is enable.
|
||||
if ctx.GlobalBool(utils.TomoTestnetFlag.Name) {
|
||||
common.IsTestnet = true
|
||||
}
|
||||
|
||||
// read passwords from environment
|
||||
passwords := []string{}
|
||||
for _, env := range cfg.Account.Passwords {
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ var (
|
|||
//utils.TestnetFlag,
|
||||
//utils.RinkebyFlag,
|
||||
//utils.VMEnableDebugFlag,
|
||||
utils.TomoTestnetFlag,
|
||||
utils.NetworkIdFlag,
|
||||
utils.RPCCORSDomainFlag,
|
||||
utils.RPCVirtualHostsFlag,
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ var (
|
|||
Name: "testnet",
|
||||
Usage: "Ropsten network: pre-configured proof-of-work test network",
|
||||
}
|
||||
TomoTestnetFlag = cli.BoolFlag{
|
||||
Name: "tomo-testnet",
|
||||
Usage: "Tomo test network",
|
||||
}
|
||||
RinkebyFlag = cli.BoolFlag{
|
||||
Name: "rinkeby",
|
||||
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
|
||||
|
|
|
|||
|
|
@ -16,3 +16,5 @@ const (
|
|||
LimitThresholdNonceInQueue = 10
|
||||
MinGasPrice = 2500
|
||||
)
|
||||
|
||||
var IsTestnet bool = false
|
||||
|
|
|
|||
|
|
@ -476,6 +476,11 @@ func whoIsCreator(snap *Snapshot, header *types.Header) (common.Address, error)
|
|||
|
||||
func (c *Posv) YourTurn(chain consensus.ChainReader, parent *types.Header, signer common.Address) (int, int, int, bool, error) {
|
||||
masternodes := c.GetMasternodes(chain, parent)
|
||||
if common.IsTestnet {
|
||||
// Only three mns for tomo testnet.
|
||||
masternodes = masternodes[:3]
|
||||
}
|
||||
log.Error("masternodes", "masternodes", len(masternodes))
|
||||
snap, err := c.GetSnapshot(chain, parent)
|
||||
if err != nil {
|
||||
log.Warn("Failed when trying to commit new work", "err", err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue