Skip to content
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

fixing overidentification of p2ms by moving the case statement below p2wpkh, p2wsh, p2tr. #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

turkycat
Copy link

segwit scripts end in hashes that may end in xAE which is misinterpreted as OP_CHECKSIG. script type is reported as p2ms in these cases.

example: ed35633eaa28f4452c4eb1b45df9f9667878f23e05a40116660bec381a000000 vout: 3

fix is simple enough: move the case statement below the segwit script types.

I also tweaked the README a bit, I hope it adds value.

before my change:

$ ./bitcoin-utxo-dump -db ~/scratch/bitcoin/node-data-copy/chainstate -f txid,vout,height,amount,script,type
...
Total UTXOs: 83310739
Total BTC:   19266337.75311853
Script Types:
 p2tr         318515
 non-standard 9565
 p2pk         47584
 p2pkh        47777074
 p2sh         15252482
 p2ms         516634
 p2wpkh       18273276
 p2wsh        1115609

after my change:

$ ./bitcoin-utxo-dump -db ~/scratch/bitcoin/node-data-copy/chainstate -f txid,vout,height,amount,script,type
...
Total UTXOs: 83310739
Total BTC:   19266337.75311853
Script Types:
 non-standard 9565
 p2pk         47584
 p2pkh        47777074
 p2sh         15252482
 p2ms         440424
 p2wpkh       18343108
 p2wsh        1120662
 p2tr         319840

difference:

 non-standard 0
 p2pk         0
 p2pkh        0
 p2sh         0
 p2ms         -76,210
 p2wpkh       +69,832
 p2wsh        +5,053
 p2tr         +1,325

…p2wpkh, p2wsh, p2tr.

segwit scripts end in hashes that may end in xAE which is misinterpreted as OP_CHECKSIG. script type is reported as p2ms in these cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant