Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict timestamp when mining a diff-adjustment block to prev-600 #15481

Closed
wants to merge 1 commit into from

Conversation

TheBlueMatt
Copy link
Contributor

This prepares us for a potential future timewarp-fixing softfork by
ensuring that we always refuse to mine blocks which refuse to
exploit timewarp, no matter the behavior of other miners. Note that
we allow timestamp to go backwards by 600 seconds on the
difficulty-adjustment blocks to avoid bricking any existing
hardware which relies on the ability to roll nTime by up to 600
seconds.

Note that it is possible that the eventual softfork to fix timewarp
has a looser resetriction than the 600 seconds enforced here,
however it seems unlikely we will apply a tighter one, and its fine
if we restrict things further on the mining end than in consensus.

@gmaxwell
Copy link
Contributor

Concept ACK.

Travis failure looks like some kind of timeout.

def run_test(self):
self.log.info('Create some old blocks')
block_1 = self.nodes[0].generate(1)[0]
for i in range(2013):
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: for _ in range(2013) is more idiomatic when the index is unused :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to generate all blocks with a singe call here: self.nodes[0].generate(nblocks=2013)?

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 27, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@TheBlueMatt
Copy link
Contributor Author

Travis failures are wholly unrelated to this PR, it seems.

assert_equal(mining_info['currentblocktx'], 0)
assert_equal(mining_info['currentblockweight'], 4000)

self.restart_node(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why restart node here? Is this just to reset mocktime? Can you call setmocktime(0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its just easier than trying to figure out what the current time is and then make sure that its correct?

This prepares us for a potential future timewarp-fixing softfork by
ensuring that we always refuse to mine blocks which refuse to
exploit timewarp, no matter the behavior of other miners. Note that
we allow timestamp to go backwards by 600 seconds on the
difficulty-adjustment blocks to avoid bricking any existing
hardware which relies on the ability to roll nTime by up to 600
seconds.

Note that it is possible that the eventual softfork to fix timewarp
has a looser resetriction than the 600 seconds enforced here,
however it seems unlikely we will apply a tighter one, and its fine
if we restrict things further on the mining end than in consensus.
@TheBlueMatt
Copy link
Contributor Author

I haven't worked on any consensus cleanup logic in some time, and it seems unlikely to be picked back up. Until there's a direction there, this probably doesn't make sense.

@bitcoin bitcoin deleted a comment from xeniosproject Jul 29, 2020
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants