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

Correct RPC time handling for getblocktemplate. #213

Merged
merged 1 commit into from
Jan 8, 2015

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jan 8, 2015

This pull request modifies the getblocktemplate RPC to correctly handle the curtime field.

Currently, the RPC server will refuse to serve a block template if the current time is before the minimum allowed time for a block even though the real generated block template already accounted for it.

This consists of three changes:

  • Remove the unnecessary and incorrect check in the RPC invocation for the current time against the min required time since it is already handled properly by the block template generation.
  • Expose the network time source to the RPC work state and use the adjusted time for checking against the maximum allowed time instead of the current time.
  • Set the returned RPC result curtime field to the time of the generated block header.

This commit modifies the getblocktemplate RPC to correctly handle the
curtime field.

Currently, the RPC server will refuse to serve a block template if the
current time is before the minimum allowed time for a block even though
the real generated block template already accounted for it.

This consists of three changes:
- Remove the unnecessary and incorrect check in the RPC invocation for the
  current time against the min required time since it is already handled
  properly by the block template generation.
- Expose the network time source to the RPC work state and use the
  adjusted time for checking against the maximum allowed time instead of
  the current time.
- Set the returned RPC result curtime field to the time of the generated
  block header.

Fixes btcsuite#209.
@jrick
Copy link
Member

jrick commented Jan 8, 2015

ok

@conformal-deploy conformal-deploy merged commit a64ffb8 into btcsuite:master Jan 8, 2015
@davecgh davecgh deleted the fix_209 branch January 15, 2015 22:50
kcalvinalvin added a commit to kcalvinalvin/btcd that referenced this pull request Nov 29, 2024
…ch-blocks-from-equal-peers

netsync: don't ask for blocks from peers on the same block height
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