0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-14 11:26:09 -05:00
bitcoin-bitcoin-core/src/rpc
Ava Chow f4849f6922
Merge bitcoin/bitcoin#29668: prune, rpc: Check undo data when finding pruneheight
8789dc8f31 doc: Add note to getblockfrompeer on missing undo data (Fabian Jahr)
4a1975008b rpc: Make pruneheight also reflect undo data presence (Fabian Jahr)
96b4facc91 refactor, blockstorage: Generalize GetFirstStoredBlock (Fabian Jahr)

Pull request description:

  The function `GetFirstStoredBlock()` helps us find the first block for which we have data. So far this function only looked for a block with `BLOCK_HAVE_DATA`. However, this doesn't mean that we also have the undo data of that block, and undo data might be required for what a user would like to do with those blocks. One example of how this might happen is if some blocks were fetched using the `getblockfrompeer` RPC. Blocks fetched from a peer will have data but no undo data.

  The first commit here allows `GetFirstStoredBlock()` to check for undo data as well by passing a parameter. This alone is useful for #29553 and I would use it there.

  In the second commit I am applying the undo check to the RPCs that report `pruneheight` to the user. I find this much more intuitive because I think the user expects to be able to do all operations on blocks up until the `pruneheight` but that is not the case if undo data is missing. I personally ran into this once before and now again when testing for assumeutxo when I had used `getblockfrompeer`. The following commit adds test coverage for this change of behavior.

  The last commit adds a note in the docs of `getblockfrompeer` that undo data will not be available.

ACKs for top commit:
  achow101:
    ACK 8789dc8f31
  furszy:
    Code review ACK 8789dc8f31.
  stickies-v:
    ACK 8789dc8f31

Tree-SHA512: 90ae8bdd07a496ade579aa25240609c61c9ed173ad38d30533f6c631fe674e5a41727478ade69ca4b71a571ad94c9da4b33ebba6b5d8821109313c2de3bdfb3d
2024-07-10 15:27:05 -04:00
..
blockchain.cpp Merge bitcoin/bitcoin#29668: prune, rpc: Check undo data when finding pruneheight 2024-07-10 15:27:05 -04:00
blockchain.h refactor, blockstorage: Generalize GetFirstStoredBlock 2024-06-21 15:00:16 +02:00
client.cpp rpc: avoid copying into UniValue 2024-05-20 16:48:19 +00:00
client.h refactor: rpc: hide and rename ParseNonRFCJSONValue() 2023-03-23 18:18:46 +00:00
external_signer.cpp rpc: avoid copying into UniValue 2024-05-20 16:48:19 +00:00
fees.cpp Merge bitcoin/bitcoin#29015: kernel: Streamline util library 2024-06-12 17:12:54 -04:00
mempool.cpp mempool: move LoadMempool/DumpMempool to node 2024-06-26 22:47:09 +00:00
mempool.h rpc: Move mempool RPCs to new file 2022-03-11 17:46:58 +01:00
mining.cpp Have testBlockValidity hold cs_main instead of caller 2024-06-27 08:58:25 +02:00
mining.h rpc: create rpc/mining.h, hoist default max tries values to constant 2020-06-01 15:08:36 +02:00
net.cpp refactor: remove warnings globals 2024-06-13 11:20:49 +01:00
node.cpp rpc: avoid copying into UniValue 2024-05-20 16:48:19 +00:00
output_script.cpp Merge bitcoin/bitcoin#28307: rpc, wallet: fix incorrect segwit redeem script size limit 2024-06-04 21:39:49 -04:00
protocol.h rpc: JSON-RPC 2.0 should not respond to "notifications" 2024-05-14 11:28:43 -04:00
rawtransaction.cpp random: drop ad-hoc Shuffle in favor of std::shuffle 2024-07-06 09:06:36 -04:00
rawtransaction_util.cpp Merge bitcoin/bitcoin#28307: rpc, wallet: fix incorrect segwit redeem script size limit 2024-06-04 21:39:49 -04:00
rawtransaction_util.h rpc: bugfix, incorrect segwit redeem script size used in signrawtransactionwithkey 2024-05-03 14:20:45 -03:00
register.h scripted-diff: Add IWYU pragma keep to bitcoin-config.h includes 2024-05-01 08:33:04 +02:00
request.cpp Merge bitcoin/bitcoin#28167: init: Add option for rpccookie permissions (replace 26088) 2024-06-27 17:35:08 -04:00
request.h Merge bitcoin/bitcoin#28167: init: Add option for rpccookie permissions (replace 26088) 2024-06-27 17:35:08 -04:00
server.cpp Merge bitcoin/bitcoin#29015: kernel: Streamline util library 2024-06-12 17:12:54 -04:00
server.h Merge bitcoin/bitcoin#27101: Support JSON-RPC 2.0 when requested by client 2024-05-16 10:18:04 -04:00
server_util.cpp Introduce Mining interface 2024-06-18 18:47:51 +02:00
server_util.h Introduce Mining interface 2024-06-18 18:47:51 +02:00
signmessage.cpp util: move util/message to common/signmessage 2024-05-16 11:16:08 -04:00
txoutproof.cpp refactor: Use Txid in CMerkleBlock 2023-11-28 17:49:41 +01:00
util.cpp move-only: move warnings from common to node 2024-06-13 11:20:47 +01:00
util.h move-only: move warnings from common to node 2024-06-13 11:20:47 +01:00