aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorMichael Dietz <michael.dietz@waya.ai>2021-02-01 09:52:07 -0600
committerMichael Dietz <michael.dietz@waya.ai>2021-03-23 10:51:43 -0400
commit085b3a729952896ccd0e40c17df569f4421f5493 (patch)
treeb6cfbbd212573c4d9af93cf03c21e39abc4352b0 /src/rpc/blockchain.cpp
parent3c87dbe95c925274f80234ad4a88beb5a05fdfff (diff)
downloadbitcoin-085b3a729952896ccd0e40c17df569f4421f5493.tar.xz
rpc: deprecate `addresses` and `reqSigs` from rpc outputs
1) add a new sane "address" field (for outputs that have an identifiable address, which doesn't include bare multisig) 2) with -deprecatedrpc: leave "reqSigs" and "addresses" intact (with all weird/wrong behavior they have now) 3) without -deprecatedrpc: drop "reqSigs" and "addresses" entirely, always.
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index b90dc9bf42..2618776b02 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1113,11 +1113,13 @@ static RPCHelpMan gettxout()
{RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
{RPCResult::Type::STR_AMOUNT, "value", "The transaction value in " + CURRENCY_UNIT},
{RPCResult::Type::OBJ, "scriptPubKey", "", {
- {RPCResult::Type::STR_HEX, "asm", ""},
+ {RPCResult::Type::STR, "asm", ""},
{RPCResult::Type::STR_HEX, "hex", ""},
- {RPCResult::Type::NUM, "reqSigs", "Number of required signatures"},
- {RPCResult::Type::STR_HEX, "type", "The type, eg pubkeyhash"},
- {RPCResult::Type::ARR, "addresses", "array of bitcoin addresses", {{RPCResult::Type::STR, "address", "bitcoin address"}}},
+ {RPCResult::Type::NUM, "reqSigs", /* optional */ true, "(DEPRECATED, returned only if config option -deprecatedrpc=addresses is passed) Number of required signatures"},
+ {RPCResult::Type::STR, "type", "The type, eg pubkeyhash"},
+ {RPCResult::Type::STR, "address", /* optional */ true, "bitcoin address (only if a well-defined address exists)"},
+ {RPCResult::Type::ARR, "addresses", /* optional */ true, "(DEPRECATED, returned only if config option -deprecatedrpc=addresses is passed) Array of bitcoin addresses",
+ {{RPCResult::Type::STR, "address", "bitcoin address"}}},
}},
{RPCResult::Type::BOOL, "coinbase", "Coinbase or not"},
}},
@@ -1775,6 +1777,16 @@ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES],
}
}
+void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
+{
+ ScriptPubKeyToUniv(scriptPubKey, out, fIncludeHex, IsDeprecatedRPCEnabled("addresses"));
+}
+
+void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo)
+{
+ TxToUniv(tx, hashBlock, IsDeprecatedRPCEnabled("addresses"), entry, include_hex, serialize_flags, txundo);
+}
+
template<typename T>
static inline bool SetHasKeys(const std::set<T>& set) {return false;}
template<typename T, typename Tk, typename... Args>