-
Notifications
You must be signed in to change notification settings - Fork 37.5k
rpc: deprecate addresses
and reqSigs
from rpc outputs
#20286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9a4f097
to
a6843f0
Compare
Is anyone using this for p2sh-multisig (passing the redeemscript into |
"addresses" for multisigs don't make sense without "reqSigs" IMO if we deprecate/remove the latter, we should also be sure to remove the former with it. ("addresses" should remain for actual address outputs) |
If we were to remove It also makes me think We'd be able to get rid of a nice chunk of code (and potentially confusing behavior). But I'm new to this repo, and I need some guidance on what should be done here. And also if I need to deprecate stuff and how I should proceed if so. Note: there is always the easy option of just fixing the |
Concept ACK on removing both "reqSigs" and "addresses", but it'll need to go through the RPC deprecation mechanism. In other places we have already removed similar fields. Especially "addresses" is a bizarre and misleading leftover from a time when addresses were only ever P2PKH and just "key identifiers". Now (... since P2SH in 2012) addresses are encodings of a specific scriptPubKey it makes no sense whatsoever that multisig is treated as "multiple addresses". |
If it's broken, we should fix it (for backporting) before removing.
I'm not sure the array format is entirely/hypothetically useless. Might as well leave it alone (or at least propose this change separately). |
a6843f0
to
c0545cc
Compare
I've re-worked this PR, and force pushed, based on the convo/feedback in this thread. Broken into two commits:
Note: This PR turned out to be more involved than I expected. I'll probably need some more feedback and pointers to get this across the finish line. Also: we'll be able to delete a few chunks of code when we can get rid of |
@mjdietzx I think it's a bit weird to fix My suggestion would be to:
That means that anyone who is currently relying on the weird `"reqSigs": `` behavior for unknown address types (for who knows what reason) isn't affected if they set the deprecation option. |
I'd prefer to keep a single-item array (better compatibility, and future-proof), but I don't care enough to object. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
f0bae44
to
0a576ef
Compare
reqSigs
from rpc outputsaddresses
and reqSigs
from rpc outputs
be593ad
to
fc484eb
Compare
Piggy backing off of #20211, now that we have: bool ExtractDestination(const CScript& scriptPubKey, TxoutType& typeRet, CTxDestination& addressRet); Could we do something like: TxoutType type;
CTxDestination dest;
ExtractDestination(m_script, type, dest);
switch (type) {
case TxoutType::PUBKEYHASH:
case TxoutType::SCRIPTHASH: return OutputType::LEGACY;
case TxoutType::WITNESS_V0_SCRIPTHASH:
case TxoutType::WITNESS_V0_KEYHASH:
case TxoutType::WITNESS_V1_TAPROOT:
case TxoutType::WITNESS_UNKNOWN: return OutputType::BECH32;
case TxoutType::PUBKEY:
case TxoutType::MULTISIG:
case TxoutType::NONSTANDARD:
case TxoutType::NULL_DATA: return nullopt; // no default case, so the compiler can warn about missing cases
}
assert(false); Instead of what we have now: CTxDestination dest;
ExtractDestination(m_script, dest);
switch (dest.which()) {
case 1 /* PKHash */:
case 2 /* ScriptHash */: return OutputType::LEGACY;
case 3 /* WitnessV0ScriptHash */:
case 4 /* WitnessV0KeyHash */:
case 5 /* WitnessUnknown */: return OutputType::BECH32;
case 0 /* CNoDestination */:
default: return nullopt;
} Note: I messed around with this, and probably made some mistakes here, but didn't see any unit tests or functional tests fail. So maybe some test coverage is needed here as well? |
re-ACK 0d83a73 only change is rebase 🤸 Show signature and timestampSignature:
Timestamp of file with hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 0d83a73 . The address feild is indeed a much better RPC output.
@sipa Mind to re-ACK? Should be close to merge, hopefully. |
0d83a73
to
9ed3a05
Compare
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.
9ed3a05
to
90ae3d8
Compare
re-ACK 90ae3d8 📢 Show signature and timestampSignature:
Timestamp of file with hash |
…ttransaction / getrawtransaction bitcoin/bitcoin#20286
Bitcoin 22.x changed how the scriptPubKey JSON reports the address, see bitcoin/bitcoin#20286. Update the checker code to support the new format.
…code/logic 43cd6b8 doc: add release notes for removal of the -deprecatedrpc=addresses flag (Michael Dietz) 2b1fdc2 refactor: minor styling, prefer snake case and same line if (Michael Dietz) d64deac refactor: share logic between ScriptPubKeyToUniv and ScriptToUniv (Michael Dietz) 8721638 rpc: remove deprecated addresses and reqSigs from rpc outputs (Michael Dietz) Pull request description: Resolves #21797 now that we've branched-off to v23 ("addresses" and "reqSigs" deprecated) "ExtractDestinations" should be removed. `-deprecatedrpc=addresses` was initially added in this PR #20286 (which resolved the original issue #20102). Some chunks of code and logic are no longer used/necessary with the removal of this, and therefore some minor refactoring is done in this PR as well (separated commits) ACKs for top commit: MarcoFalke: re-ACK 43cd6b8 🐉 meshcollider: Code review ACK 43cd6b8 jonatack: ACK 43cd6b8 per `git range-diff a9d0cec 92dc5e9 43cd6b8`, also rebased to latest master, debug built + quick re-review of each commit to bring back context, and ran tests locally at the final commit Tree-SHA512: fba83495e396d3c06f0dcf49292f14f4aa6b68fa758f0503941fade1a6e7271cda8378e2734af1faea550d1b43c85a36c52ebcc9dec0732936f9233b4b97901c
Considering the limited applicability of
reqSigs
and the confusing output of1
in all cases except bare multisig, theaddresses
andreqSigs
outputs are removed for all rpc commands.Note: Some light refactoring done to allow us to very easily delete a few chunks of code (marked with TODOs) when we remove this deprecated behavior.
Using
IsDeprecatedRPCEnabled
in core_write.cpp caused some circular dependencies involving core_ioCircular dependencies were caused by rpc/util unnecessarily importing node/coinstats and node/transaction. Really what rpc/util needs are some fundamental type/helper-function definitions. So this was cleaned up to make more sense.
This fixes #20102.