HomePhabricator

Use a numeric verbosity with getblock RPC to allow retrieval of the raw…

Description

Use a numeric verbosity with getblock RPC to allow retrieval of the raw transactions

Summary:
This patch changes the getblock RPC verbose boolean argument into a numeric argument called verbosity. The argument now accepts a third option that includes the full raw transactions. Boolean values are still accepted for backwards compatibility, and the default behavior when the argument is omitted remains the same. The possible options for verbosity are: 0 or false for hex-encoded, 1 or true (default) for JSON, and 2 for JSON including the full raw transactions. This patch is simply a port of https://github.com/bitcoin/bitcoin/commit/e3c9f2ddb1e49f719cc1f3f7cc2a98626bee4364.

Backport of Core PR8704

Co-authored-by: Andrew Chow <achow101-github@achow101.com>
Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>

Test Plan: Call the getblock RPC with a blockhash and 0, 1, 2, true, false for the verbosity argument. Call it without the verbosity argument to check default behavior.

Reviewers: deadalnix, O1 Bitcoin ABC, #bitcoin_abc, lannocc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1762