-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
add function to determine script-type for all inputs in a psbt #6984
Conversation
Specifically which BIPs use either naming convention? |
BIP-174(psbt) for example has Test Vectors and their description uses the later form. |
Well our nomenclature predates BIP174; I think it predates any BIP that has one :) |
Thanks for the explanation. |
if match_script_against_template(decoded, SCRIPTPUBKEY_TEMPLATE_P2WPKH): | ||
return 'p2wpkh' | ||
if match_script_against_template(decoded, SCRIPTPUBKEY_TEMPLATE_P2WSH): | ||
return 'p2wsh' |
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.
Note that in many other places in transaction.py
, a script_type
of "p2sh" means p2sh-multisig, while a "p2wsh" means p2wsh-multisig.
I guess something will have to be done about that sooner or later anyway... Maybe it's ok to ignore that for now.
However, this is something to keep in mind if you are planning on comparing these script_type strings to determine if certain inputs use similar scripts.
Ah, actually this might already become a problem here. It seems to me that electrum/electrum/transaction.py Lines 1334 to 1352 in d34b8d6
electrum/electrum/transaction.py Lines 1354 to 1370 in d34b8d6
electrum/electrum/transaction.py Line 1126 in d34b8d6
I think the easiest fix would be to limit the detection added in this PR to only The longer term fix would be
|
Oh, interesting case. I agree this is a good solution for now.
This are the only types defined for Payjoin anyway. |
Thanks. |
Currently it's only possible to set the script-type for the inputs in a psbt for wallet owned inputs. For other imported inputs(payjoin) they stay 'unknown'.
This PR adds a function to determine the inputs-types by checking if a script(in scriptpubkey or redeem-script) matches a scripts pattern.
I wanna use this function in this PR: #6804 to validate equality of input-types in the payjoin.
general question:
Why is the naming of the script-types different than in most other application/BIPs? If I'm right, in Electrum composed names are in the form: [inner/encapsulated-type]-outer (p2wpkh-p2sh), but in the BIP's the naming is p2sh-p2wpkh. Do I understand it correctly?