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"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
||||||
"github.com/naoina/toml"
|
"github.com/naoina/toml"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -151,6 +152,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, tomoConfig) {
|
||||||
ctx.Set(utils.NATFlag.Name, cfg.NAT)
|
ctx.Set(utils.NATFlag.Name, cfg.NAT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check testnet is enable.
|
||||||
|
if ctx.GlobalBool(utils.TomoTestnetFlag.Name) {
|
||||||
|
common.IsTestnet = true
|
||||||
|
}
|
||||||
|
|
||||||
// read passwords from environment
|
// read passwords from environment
|
||||||
passwords := []string{}
|
passwords := []string{}
|
||||||
for _, env := range cfg.Account.Passwords {
|
for _, env := range cfg.Account.Passwords {
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ var (
|
||||||
//utils.TestnetFlag,
|
//utils.TestnetFlag,
|
||||||
//utils.RinkebyFlag,
|
//utils.RinkebyFlag,
|
||||||
//utils.VMEnableDebugFlag,
|
//utils.VMEnableDebugFlag,
|
||||||
|
utils.TomoTestnetFlag,
|
||||||
utils.NetworkIdFlag,
|
utils.NetworkIdFlag,
|
||||||
utils.RPCCORSDomainFlag,
|
utils.RPCCORSDomainFlag,
|
||||||
utils.RPCVirtualHostsFlag,
|
utils.RPCVirtualHostsFlag,
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,10 @@ var (
|
||||||
Name: "testnet",
|
Name: "testnet",
|
||||||
Usage: "Ropsten network: pre-configured proof-of-work test network",
|
Usage: "Ropsten network: pre-configured proof-of-work test network",
|
||||||
}
|
}
|
||||||
|
TomoTestnetFlag = cli.BoolFlag{
|
||||||
|
Name: "tomo-testnet",
|
||||||
|
Usage: "Tomo test network",
|
||||||
|
}
|
||||||
RinkebyFlag = cli.BoolFlag{
|
RinkebyFlag = cli.BoolFlag{
|
||||||
Name: "rinkeby",
|
Name: "rinkeby",
|
||||||
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
|
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,5 @@ const (
|
||||||
LimitThresholdNonceInQueue = 10
|
LimitThresholdNonceInQueue = 10
|
||||||
MinGasPrice = 2500
|
MinGasPrice = 2500
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var IsTestnet bool = false
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
inmemorySnapshots = 128 // Number of recent vote snapshots to keep in memory
|
inmemorySnapshots = 128 // Number of recent vote snapshots to keep in memory
|
||||||
M2ByteLength = 4
|
M2ByteLength = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
type Masternode struct {
|
type Masternode struct {
|
||||||
|
|
@ -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) {
|
func (c *Posv) YourTurn(chain consensus.ChainReader, parent *types.Header, signer common.Address) (int, int, int, bool, error) {
|
||||||
masternodes := c.GetMasternodes(chain, parent)
|
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)
|
snap, err := c.GetSnapshot(chain, parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("Failed when trying to commit new work", "err", err)
|
log.Warn("Failed when trying to commit new work", "err", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue