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
Failure to correctly type P2PKHScriptSignatures #57
Comments
This was referenced Feb 16, 2017
Merged
fixed in #61 |
This issue still isn't resolved, just had a build fail, see: https://travis-ci.org/bitcoin-s/bitcoin-s-core/builds/207431219#L2767 |
Merged
dwhjames
pushed a commit
to dwhjames/bitcoin-s-core
that referenced
this issue
Feb 22, 2019
…e-fix wrapped segwit extends BitcoinAddress instead of Address
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Every
P2PKHScriptSignature
should follow the following format:<sig> <pubkey>
Currently we have a naive typing algorithm for classifying
P2PKHScriptSignature
. The algorithm is defined hereas you can see, we pattern match on the given asm tokens and see if we have a script signature of the format
<pushop for sig> <sig> <pushop for pubkey> <pubkey>
This works in 99% of cases, except when we have a
P2SHScriptSignature
which is required to only be pushops. We can nest aP2PKScriptPubKey
inside of aP2SHScriptSignature
to have the exact same format as above. TheP2SHScriptSignature
looks like:<pushop for sig> <sig> <pushop for redeemScript> <P2PK redeemScript>
This causes
isP2PKHScriptSig
to return false, which is the cause for this travis failure:https://travis-ci.org/bitcoin-s/bitcoin-s-core/builds/201652191
Solution
The most obvious solution is after we add libsecp256k1 we add a check inside of
isP2PKHScriptSig
to detect if the constantz
is a valid public key. If it is a valid public key, we assume that the given asm is not aP2PKHScriptSignature
Bitcoin Core relies on libsecp256k1 functionality to determine if a pubkey is valid or not, I suggest using that same check inside of
isValidP2PKHScriptSig
once we integrate libsecp256k1 which should solve our problem. Depends on #50The text was updated successfully, but these errors were encountered: