Skip to content

[backport] rpc: Add level 3 verbosity to `getblock` RPC call; Add `fee` to level 2

Calin Culianu requested to merge cculianu/bitcoin-cash-node:issue_459 into master

Co-authored-by: Luke Dashjr luke_github1@dashjr.org Co-authored-by: 0xB10C 19157360+0xB10C@users.noreply.github.com Co-authored-by: Calin Culianu calin.culianu@gmail.com

Merge instructions: Please preserve authorship in commit message

Summary

This fixes issue #459 (closed).

This is a modified backport of a few Core PRs:

bitcoin#21245, bitcoin#23320, bitcoin#22918

It adds fee to getblock verbosity level 2, and also adds a new level 3 which can also display prevout info per transaction (requires undo file for the block in question be present otherwise it's identical to 2).

The existing /rest/block/ REST endpoint is modified to contain this information too.

Test Plan

  • ninja all check-all
  • Verify rpc help got getblock looks ok: bitcoin-cli help getblock
  • Perhaps try the new getblock with verbosity 2 or 3. Verify that the fee is present for level 2 and for level 3 you should see fees plus prevout info (only works if undo file is present -- that is on the main chain for a non-pruned block).
Edited by Calin Culianu

Merge request reports