This PR adds a return value to the RPC invalidateblock. For now the the return object has the key invalidated.
rpc: Return whether the block was invalidated on invalidateblock #15494
pull promag wants to merge 2 commits into bitcoin:master from promag:2019-02-invalidateblock changing 2 files +8 −2-
promag commented at 12:32 PM on February 27, 2019: member
- fanquake added the label RPC/REST/ZMQ on Feb 27, 2019
-
DrahtBot commented at 2:11 PM on February 27, 2019: member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
No conflicts as of last run.
-
in src/validation.cpp:2806 in a2195cf8f7 outdated
2832 | - } 2833 | + DisconnectedBlockTransactions disconnectpool; 2834 | + bool ret = DisconnectTip(state, chainparams, &disconnectpool); 2835 | + // DisconnectTip will add transactions to disconnectpool. 2836 | + // Adjust the mempool to be consistent with the new tip, adding 2837 | + // transactions back to the mempool if disconnecting was succesful,
practicalswift commented at 8:23 PM on February 28, 2019:Should be "successful"? :-)
DrahtBot added the label Needs rebase on Mar 7, 2019rpc: Return whether the block was invalidated on invalidateblock 4bd3caeaa4qa: Test invalidateblock result d5dd80c3e9promag force-pushed on Mar 8, 2019promag commented at 3:43 PM on March 8, 2019: memberRebased.
DrahtBot removed the label Needs rebase on Mar 8, 2019in src/rpc/blockchain.cpp:1603 in d5dd80c3e9
1596 | @@ -1597,7 +1597,12 @@ static UniValue invalidateblock(const JSONRPCRequest& request) 1597 | throw JSONRPCError(RPC_DATABASE_ERROR, FormatStateMessage(state)); 1598 | } 1599 | 1600 | - return NullUniValue; 1601 | + UniValue res(UniValue::VOBJ); 1602 | + { 1603 | + LOCK(cs_main); 1604 | + res.pushKV("invalidated", !chainActive.Contains(pblockindex));
laanwj commented at 3:00 PM on June 6, 2019:Need to be documented in the RPC help. Please also mention in what cases it can happen that the block was not invalidated but it does get all the way to the end here.
promag commented at 3:22 PM on October 10, 2019:Thinking again maybe it should throw instead. Main reason to fail is https://github.com/bitcoin/bitcoin/blob/2a0164085b001a79b8d37b28751b115322124cfc/src/validation.cpp#L3022-L3026
DrahtBot closed this on Mar 9, 2020DrahtBot commented at 8:34 PM on March 9, 2020: member<!--5d09a71f8925f3f132321140b44b946d-->The last travis run for this pull request was 364 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened.
DrahtBot reopened this on Mar 9, 2020promag closed this on Apr 27, 2020promag deleted the branch on Apr 27, 2020DrahtBot locked this on Feb 15, 2022ContributorsLabels
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC
More mirrored repositories can be found on mirror.b10c.me