mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Merge pull request #441 from ngtuna/custom-testnet
testnet: add hard-fork block, allow nodes to sign block
This commit is contained in:
commit
f94b2cac64
3 changed files with 5 additions and 4 deletions
|
|
@ -21,6 +21,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var TIP2019Block = big.NewInt(1050000)
|
var TIP2019Block = big.NewInt(1050000)
|
||||||
|
var TestnetHF1 = uint64(909000)
|
||||||
var IsTestnet = false
|
var IsTestnet = false
|
||||||
var StoreRewardFolder string
|
var StoreRewardFolder string
|
||||||
var RollbackHash Hash
|
var RollbackHash Hash
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ func (c *Posv) verifyHeaderWithCache(chain consensus.ChainReader, header *types.
|
||||||
// looking those up from the database. This is useful for concurrently verifying
|
// looking those up from the database. This is useful for concurrently verifying
|
||||||
// a batch of new headers.
|
// a batch of new headers.
|
||||||
func (c *Posv) verifyHeader(chain consensus.ChainReader, header *types.Header, parents []*types.Header, fullVerify bool) error {
|
func (c *Posv) verifyHeader(chain consensus.ChainReader, header *types.Header, parents []*types.Header, fullVerify bool) error {
|
||||||
if common.IsTestnet {
|
if common.IsTestnet && header.Number.Uint64() >= common.TestnetHF1 {
|
||||||
fullVerify = false
|
fullVerify = false
|
||||||
}
|
}
|
||||||
if header.Number == nil {
|
if header.Number == nil {
|
||||||
|
|
@ -490,7 +490,7 @@ func (c *Posv) YourTurn(chain consensus.ChainReader, parent *types.Header, signe
|
||||||
if common.IsTestnet {
|
if common.IsTestnet {
|
||||||
// Only three mns hard code for tomo testnet.
|
// Only three mns hard code for tomo testnet.
|
||||||
masternodes = masternodes[:3]
|
masternodes = masternodes[:3]
|
||||||
if parent.Number.Uint64() >= 909000 {
|
if parent.Number.Uint64() >= common.TestnetHF1 {
|
||||||
masternodes = []common.Address{
|
masternodes = []common.Address{
|
||||||
common.HexToAddress("0xfFC679Dcdf444D2eEb0491A998E7902B411CcF20"),
|
common.HexToAddress("0xfFC679Dcdf444D2eEb0491A998E7902B411CcF20"),
|
||||||
common.HexToAddress("0xd76fd76F7101811726DCE9E43C2617706a4c45c8"),
|
common.HexToAddress("0xd76fd76F7101811726DCE9E43C2617706a4c45c8"),
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Can't verify masternode permission: %v", err)
|
return fmt.Errorf("Can't verify masternode permission: %v", err)
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok && !common.IsTestnet {
|
||||||
// silently return as this node doesn't have masternode permission to sign block
|
// silently return as this node doesn't have masternode permission to sign block
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -580,7 +580,7 @@ func (s *Ethereum) ValidateMasternode() (bool, error) {
|
||||||
} else {
|
} else {
|
||||||
return false, fmt.Errorf("Only verify masternode permission in PoSV protocol")
|
return false, fmt.Errorf("Only verify masternode permission in PoSV protocol")
|
||||||
}
|
}
|
||||||
if common.IsTestnet {
|
if common.IsTestnet && s.blockchain.CurrentHeader().Number.Uint64() >= common.TestnetHF1 {
|
||||||
masternodes := []common.Address{
|
masternodes := []common.Address{
|
||||||
common.HexToAddress("0xfFC679Dcdf444D2eEb0491A998E7902B411CcF20"),
|
common.HexToAddress("0xfFC679Dcdf444D2eEb0491A998E7902B411CcF20"),
|
||||||
common.HexToAddress("0xd76fd76F7101811726DCE9E43C2617706a4c45c8"),
|
common.HexToAddress("0xd76fd76F7101811726DCE9E43C2617706a4c45c8"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue