-
Notifications
You must be signed in to change notification settings - Fork 866
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
[bug] non-mandatory-script-verify-flag Error when pushing tx made by pybitcointools #89
Comments
chris-belcher
changed the title
non-mandatory-script-verify-flag Error when pushing tx made by pybitcointools
[bug] non-mandatory-script-verify-flag Error when pushing tx made by pybitcointools
Apr 26, 2015
petertodd/python-bitcoinlib@f6e8dc9 fixes the same bug in a similar library |
I've solved this issue so low s is always signed: see my pybitcointools fork In
def der_encode_sig(v, r, s):
"""Takes (vbyte, r, s) as ints and returns hex der encode sig"""
s = N-s if s>N//2 else s # BIP62 low s
b1, b2 = encode(r, 256), encode(s, 256)
if bytearray(b1)[0] & 0x80: # add null bytes if leading byte interpreted as negative
b1 = b'\x00' + b1
if bytearray(b2)[0] & 0x80:
b2 = b'\x00' + b2
left = b'\x02' + encode(len(b1), 256, 1) + b1
right = b'\x02' + encode(len(b2), 256, 1) + b2
sighex = safe_hexlify(b'\x30' + encode(len(left+right), 256, 1) + left + right)
# check BIP66, see https://github.com/simcity4242/pybitcointools/blob/master/bitcoin/transaction.py#L181-L204
assert is_bip66(sighex)
return sighex |
Thanks for solving it @simcity4242 |
Ping? |
pong |
Spam on Github Issues! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is code that reproduces the tx. It is a regtest tx, I could upload my regtest/ directory if required.
When run
Using sendrawtransaction on bitcoin core console produces this error
The relevant line the debug.log
The text was updated successfully, but these errors were encountered: