Fix on from_scriptPubKey while accept_bare_checksig=True (bitcoin mainnet 111 block)
fcmercury opened this issue · 1 comments
`
import bitcointx
import bitcointx.rpc
from bitcointx.core import *
from bitcointx.core.script import CScript, IsLowDERSignature
from bitcointx.core.key import CPubKey
from bitcointx.wallet import *
proxy = bitcointx.rpc.Proxy(service_url="_MAINNET_URL", timeout=10)
chash = proxy.getrawtransaction(lx("e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97"))
scriptPubKey = chash.vout[0].scriptPubKey
actual = CBitcoinAddress.from_scriptPubKey(scriptPubKey)
expected = P2PKHBitcoinAddress.from_pubkey(scriptPubKey[1:66])
`
actual
P2PKHBitcoinAddress('1FfxRsEZwZkdHjuwBv815eqTWgEbQKpJF7')
expected
P2PKHBitcoinAddress('1HCeeU957J4NTXDer2fGvDsb7mVjU9TtLb')
bitcoin-cli getrawtransaction e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97 1
{
"txid": "e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97",
"hash": "e7a3e246c6f2d582b089d7d6c2f925e8aae46ef0c0ce97d3dd3afe3016a44e97",
"version": 1,
"size": 135,
"vsize": 135,
"weight": 540,
"locktime": 0,
"vin": [
{
"coinbase": "04ffff001d02a700",
"sequence": 4294967295
}
],
"vout": [
{
"value": 50.00000000,
"n": 0,
"scriptPubKey": {
"asm": "04a75502d3670b14b7e5640591191c05868da841699d52f9752a70dc891183a2b9a00f7a5893389f3b973a8ac5e30c20041ccbd99a3889b7ae7a705203d0991498 OP_CHECKSIG",
"hex": "4104a75502d3670b14b7e5640591191c05868da841699d52f9752a70dc891183a2b9a00f7a5893389f3b973a8ac5e30c20041ccbd99a3889b7ae7a705203d0991498ac",
"reqSigs": 1,
"type": "pubkey",
"addresses": [
"1HCeeU957J4NTXDer2fGvDsb7mVjU9TtLb"
]
}
}
],
"hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0804ffff001d02a700ffffffff0100f2052a01000000434104a75502d3670b14b7e5640591191c05868da841699d52f9752a70dc891183a2b9a00f7a5893389f3b973a8ac5e30c20041ccbd99a3889b7ae7a705203d0991498ac00000000",
"blockhash": "000000004d6a6dd8b882deec7b54421949dddd2c166bd51ee7f62a52091a6c35",
"confirmations": 553173,
"time": 1231669673,
"blocktime": 1231669673
}
bitcointx/wallet.py
270 - pubkey = scriptPubKey[1:65]
270 + pubkey = scriptPubKey[1:66]
Fixed in 75cef4e
Thanks for reporting this bug here and at petertodd#197