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

[rpc] Correct reconsiderblock help text, add test #15057

Merged
merged 1 commit into from Jan 7, 2019

Conversation

@MarcoFalke
Copy link
Member

@MarcoFalke MarcoFalke commented Dec 29, 2018

Rework documentation and test to match the implementation

@DrahtBot
Copy link
Contributor

@DrahtBot DrahtBot commented Dec 29, 2018

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

Coverage

Coverage Change (pull 15057, a830d1c4d3eeac4c869c9a061d64e2722a1a252a) Reference (master, a1fd876)
Lines -0.0129 % 87.3755 %
Functions -0.0452 % 84.5100 %
Branches -0.0079 % 51.3984 %

Updated at: 2018-12-29T18:13:51.889322.

@ch4ot1c
Copy link
Contributor

@ch4ot1c ch4ot1c commented Dec 29, 2018

utACK

@gmaxwell
Copy link
Contributor

@gmaxwell gmaxwell commented Jan 1, 2019

IIRC if you have a chain A B C D E and invalidate D then invalidate B, then reconsider B you'll end back up on E.

@MarcoFalke
Copy link
Member Author

@MarcoFalke MarcoFalke commented Jan 1, 2019

Added a test for this as well (and fixed up the help text). Maybe the method should have been called reconsiderchain with the description "Reconsiders all chains the given block is in"

@laanwj
Copy link
Member

@laanwj laanwj commented Jan 2, 2019

utACK fa38d3d

Copy link
Member

@promag promag left a comment

Some comments/questions, other than that looks great.

self.nodes[1].invalidateblock(blocks[-1])
self.nodes[1].invalidateblock(blocks[-2])
assert_equal(self.nodes[1].getbestblockhash(), blocks[-3])
# Reconsider only the previous tip
Copy link
Member

@promag promag Jan 2, 2019

s/previous/initial/

blocks = self.nodes[1].generatetoaddress(10, ADDRESS_BCRT1_UNSPENDABLE)
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
# Invalidate the two blocks at the tip
self.nodes[1].invalidateblock(blocks[-1])
Copy link
Member

@promag promag Jan 2, 2019

remove?

blocks = self.nodes[1].generatetoaddress(10, ADDRESS_BCRT1_UNSPENDABLE)
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
# Invalidate the two blocks at the tip
self.nodes[1].invalidateblock(blocks[-2])
Copy link
Member

@promag promag Jan 2, 2019

remove?

Copy link
Member Author

@MarcoFalke MarcoFalke Jan 3, 2019

Why? This is exactly what the test should be testing for. See #15057 (comment)

Copy link
Member

@promag promag Jan 3, 2019

Yap sorry.

@promag
Copy link
Member

@promag promag commented Jan 5, 2019

utACK fa38d3d, don't mind the above nits..

Candidate for backport?

@MarcoFalke
Copy link
Member Author

@MarcoFalke MarcoFalke commented Jan 5, 2019

I'd say no. User-facing it is only a minor documentation fixup of a method that should not casually be used in production.

@laanwj laanwj merged commit fa38d3d into bitcoin:master Jan 7, 2019
2 checks passed
laanwj added a commit that referenced this issue Jan 7, 2019
fa38d3d [rpc] Correct reconsiderblock help text, add test (MarcoFalke)

Pull request description:

  Rework documentation and test to match the implementation

Tree-SHA512: d0adef6b054a341bcc1cb87783a4e4cf9be124ba6812e1ac88246a5e01b2861a8071b12dba880b2b428c37da3fa860bfec3fe3e5fbb7c28696872113faa84a9f
@MarcoFalke MarcoFalke deleted the Mf1608-qaAssert branch Jan 10, 2019
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this issue Oct 19, 2020
Summary:
```
Rework documentation and test to match the implementation
```

Backport of core [[bitcoin/bitcoin#15057 | PR15057]].

Test Plan:
  ./test/functional/test_runner.py rpc_invalidateblock

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants