aboutsummaryrefslogtreecommitdiff
path: root/src/core_write.cpp
diff options
context:
space:
mode:
authorMichael Dietz <michael.dietz@waya.ai>2021-05-10 14:13:40 -0400
committerMichael Dietz <michael.dietz@waya.ai>2021-09-24 14:22:49 -0500
commit8721638daa8502c7f8de5ae24a9393d7290a2ce5 (patch)
tree9ee67d85ad3b4fc72b465b5c8431eb83b274375f /src/core_write.cpp
parent03cb2b480bd5e35cd6bafbca3ff6adcba52dab8b (diff)
downloadbitcoin-8721638daa8502c7f8de5ae24a9393d7290a2ce5.tar.xz
rpc: remove deprecated addresses and reqSigs from rpc outputs
Diffstat (limited to 'src/core_write.cpp')
-rw-r--r--src/core_write.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/core_write.cpp b/src/core_write.cpp
index b35f835f42..4850ef969f 100644
--- a/src/core_write.cpp
+++ b/src/core_write.cpp
@@ -156,41 +156,24 @@ void ScriptToUniv(const CScript& script, UniValue& out, bool include_address)
}
}
-// TODO: from v23 ("addresses" and "reqSigs" deprecated) this method should be refactored to remove the `include_addresses` option
-// this method can also be combined with `ScriptToUniv` as they will overlap
-void ScriptPubKeyToUniv(const CScript& scriptPubKey,
- UniValue& out, bool fIncludeHex, bool include_addresses)
+void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
{
- TxoutType type;
CTxDestination address;
- std::vector<CTxDestination> addresses;
- int nRequired;
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
if (fIncludeHex)
out.pushKV("hex", HexStr(scriptPubKey));
- if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) || type == TxoutType::PUBKEY) {
- out.pushKV("type", GetTxnOutputType(type));
- return;
- }
+ std::vector<std::vector<unsigned char>> solns;
+ TxoutType type = Solver(scriptPubKey, solns);
- if (ExtractDestination(scriptPubKey, address)) {
+ if (ExtractDestination(scriptPubKey, address) && type != TxoutType::PUBKEY) {
out.pushKV("address", EncodeDestination(address));
}
out.pushKV("type", GetTxnOutputType(type));
-
- if (include_addresses) {
- UniValue a(UniValue::VARR);
- for (const CTxDestination& addr : addresses) {
- a.push_back(EncodeDestination(addr));
- }
- out.pushKV("addresses", a);
- out.pushKV("reqSigs", nRequired);
- }
}
-void TxToUniv(const CTransaction& tx, const uint256& hashBlock, bool include_addresses, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo)
+void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, int serialize_flags, const CTxUndo* txundo)
{
entry.pushKV("txid", tx.GetHash().GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
@@ -249,7 +232,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, bool include_add
out.pushKV("n", (int64_t)i);
UniValue o(UniValue::VOBJ);
- ScriptPubKeyToUniv(txout.scriptPubKey, o, true, include_addresses);
+ ScriptPubKeyToUniv(txout.scriptPubKey, o, true);
out.pushKV("scriptPubKey", o);
vout.push_back(out);