Skip to content

Commit 1d6b65c

Browse files
committed
[release/1.4.10] cmd/utils, eth: display the user's current fork, minor text tweak
(cherry picked from commit 993b412)
1 parent 1b2941c commit 1d6b65c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

cmd/utils/flags.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,8 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
793793
// If the chain is already initialized, use any existing chain configs
794794
config := new(core.ChainConfig)
795795

796-
if genesis := core.GetBlock(db, core.GetCanonicalHash(db, 0)); genesis != nil {
796+
genesis := core.GetBlock(db, core.GetCanonicalHash(db, 0))
797+
if genesis != nil {
797798
storedConfig, err := core.GetChainConfig(db, genesis.Hash())
798799
switch err {
799800
case nil:
@@ -827,6 +828,23 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
827828
case ctx.GlobalBool(OpposeDAOFork.Name):
828829
config.DAOForkSupport = false
829830
}
831+
// Temporarilly display a proper message so the user knows which fork its on
832+
if !ctx.GlobalBool(TestNetFlag.Name) && (genesis == nil || genesis.Hash() == common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")) {
833+
choice := "SUPPORT"
834+
if !config.DAOForkSupport {
835+
choice = "OPPOSE"
836+
}
837+
current := fmt.Sprintf("Geth is currently configured to %s the DAO hard-fork!", choice)
838+
howtoswap := fmt.Sprintf("You can change your choice prior to block #%v with --support-dao-fork or --oppose-dao-fork.", config.DAOForkBlock)
839+
howtosync := fmt.Sprintf("After the hard-fork block #%v passed, changing chains requires a resync from scratch!", config.DAOForkBlock)
840+
separator := strings.Repeat("-", len(howtoswap))
841+
842+
glog.V(logger.Warn).Info(separator)
843+
glog.V(logger.Warn).Info(current)
844+
glog.V(logger.Warn).Info(howtoswap)
845+
glog.V(logger.Warn).Info(howtosync)
846+
glog.V(logger.Warn).Info(separator)
847+
}
830848
return config
831849
}
832850

eth/handler_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ func testDAOChallenge(t *testing.T, localForked, remoteForked bool, timeout bool
638638
if err := p2p.Send(peer.app, BlockHeadersMsg, []*types.Header{blocks[0].Header()}); err != nil {
639639
t.Fatalf("failed to answer challenge: %v", err)
640640
}
641+
time.Sleep(100 * time.Millisecond) // Sleep to avoid the verification racing with the drops
641642
} else {
642643
// Otherwise wait until the test timeout passes
643644
time.Sleep(daoChallengeTimeout + 500*time.Millisecond)

0 commit comments

Comments
 (0)