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

Fix on from_scriptPubKey accept_bare_checksig #197

Open
fcmercury opened this issue Dec 11, 2018 · 1 comment
Open

Fix on from_scriptPubKey accept_bare_checksig #197

fcmercury opened this issue Dec 11, 2018 · 1 comment

Comments

@fcmercury
Copy link

`
import bitcoin
import bitcoin.rpc
from bitcoin.core import *
from bitcoin.core.script import CScript, IsLowDERSignature
from bitcoin.core.key import CPubKey
from bitcoin.wallet import *

proxy = bitcoin.rpc.Proxy(service_url="mainnet url", timeout=10)

chash = proxy.getrawtransaction(lx("e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97"))

scriptPubKey = chash.vout[0].scriptPubKey

actual = P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey)

expected = P2PKHBitcoinAddress.from_pubkey(scriptPubKey[1:66])
`

actual
P2PKHBitcoinAddress('1FfxRsEZwZkdHjuwBv815eqTWgEbQKpJF7')
expected
P2PKHBitcoinAddress('1HCeeU957J4NTXDer2fGvDsb7mVjU9TtLb')

link:
https://btc.com/e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97

wallet.py
195 - pubkey = scriptPubKey[1:65]
195 + pubkey = scriptPubKey[1:66]

@dgpv
Copy link
Contributor

dgpv commented Dec 12, 2018

Looks like the code that handles uncompressed pubkeys with bare checksig takes one byte short of the pubkey:

pubkey = scriptPubKey[1:65]

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

No branches or pull requests

2 participants