Open fcmercury opened 5 years ago
` 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]
Looks like the code that handles uncompressed pubkeys with bare checksig takes one byte short of the pubkey:
https://github.com/petertodd/python-bitcoinlib/blob/73110cb22d66af51cdff9d4d50f088c80b4c496a/bitcoin/wallet.py#L195
` 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]) `
link: https://btc.com/e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97
wallet.py 195 - pubkey = scriptPubKey[1:65] 195 + pubkey = scriptPubKey[1:66]