Skip to content

Delay starting node until Genesis time#2389

Merged
melekes merged 3 commits intodevelopfrom
zarko/2294-wait-until-genesis-time
Sep 18, 2018
Merged

Delay starting node until Genesis time#2389
melekes merged 3 commits intodevelopfrom
zarko/2294-wait-until-genesis-time

Conversation

@milosevic
Copy link
Contributor

@milosevic milosevic commented Sep 13, 2018

Refs #2294

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

now := tmtime.Now()
genTime := n.genesisDoc.GenesisTime
if genTime.After(now) {
time.Sleep(genTime.Sub(now))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should print a message like "Genesis time is in the future. Sleeping until then..."


// create & start node
n, err := DefaultNewNode(config, log.TestingLogger())
n.GenesisDoc().GenesisTime = now.Add(5 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this reliably pass for smaller values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It pass for 10 millisecond.

@melekes melekes merged commit 2fbf810 into develop Sep 18, 2018
@melekes melekes deleted the zarko/2294-wait-until-genesis-time branch September 18, 2018 09:16
@ebuchman
Copy link
Contributor

With this sleep we can't kill the program with SIGINT - see #2434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants