This PR removes almost all of the TxToJSON()
and ScriptPubKeyToJSON()
code from bitcoin-rpc and places it in bitcoin-common, removing about 80 lines of duplicate code. The only part that can’t be moved into bitcoin-common is parsing block contextual information (confirmations and blocktime), which are not available to bitcoin-common code.
This PR should be merged along with #8817 , which ensures that witness data gets returned from calls to TxToUniv()