Author of #21245 expressed time issues in the original PR. Given that #21245 has received a lot of review*, I have decided to open this new pull request with modifications required to get ACK from luke-jr and a few nits of mine.
Original PR description
Display the prevout in transaction inputs when calling getblock level 3 verbosity. This PR affects the existing
/rest/block
API by adding aprevout
fields to tx inputs. This is mentioned in the change to the release notes.I added some functional tests that
* checks that the RPC call still works when TxUndo can't be found * Doesn't display the "value" or "scriptPubKey" of the previous output when at a lower verbosity level
This “completes” the issue #18771
Possible improvements
- https://github.com/kiminuo/bitcoin/commit/b0bf4f255f86aeaddce68889087c22f9068f4d97 - I can include even this commit to this PR if deemed useful or I can leave it for a follow-up PR. See #21245 (comment) for more context.
Examples
Examples of the getblock
output with various verbose levels. Note that 000000000000001f682b188971cc1a121546be4e9d5baf22934fdc7f538288d5
contains only 2 transactions.
(See: #21245 (comment))
Verbose level 0
0./bitcoin-cli -testnet getblock 000000000000001f682b188971cc1a121546be4e9d5baf22934fdc7f538288d5 0
Verbose level 1
0./bitcoin-cli -testnet getblock 000000000000001f682b188971cc1a121546be4e9d5baf22934fdc7f538288d5 1
Verbose level 2
0./bitcoin-cli -testnet getblock 000000000000001f682b188971cc1a121546be4e9d5baf22934fdc7f538288d5 2
Verbose level 3
0./bitcoin-cli -testnet getblock 000000000000001f682b188971cc1a121546be4e9d5baf22934fdc7f538288d5 3
REST
0curl -H "content-type:text/plain;" http://127.0.0.1:18332/rest/block/000000000000001f682b188971cc1a121546be4e9d5baf22934fdc7f538288d5.json
* … and my everyday obsessive checking of my email inbox whether the PR moves forward.
Edit laanwj: Removed at symbol from message, and large example output to prevent it from all ending up in the commit message.