0

I'm having several problems getting tests to successfully run under my fork (or vbuterin's pybitcointools, and I'm hoping someone with a combined Python / Bitcoin knowledge can provide some insight.

Here's the error message (as submitted to #145):

======================================================================
FAIL: test_all (__main__.TestTransaction)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/AA78F2EC-3EE8-40F4-A318-8A9AB1BCB5FF/Pythonista3/Documents/pybitcointools-vbuterin/test.py", line 179, in test_all
    self.assertTrue(verify_tx_input(tx1, 0, mscript, sig1, pubs[1]), "Verification Error")
AssertionError: Verification Error

======================================================================
FAIL: test_all (__main__.TestTransactionSignVerify)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/AA78F2EC-3EE8-40F4-A318-8A9AB1BCB5FF/Pythonista3/Documents/pybitcointools-vbuterin/test.py", line 133, in test_all
    "Verification error"
AssertionError: Verification error

----------------------------------------------------------------------
Ran 18 tests in 6.944s

FAILED (failures=2, errors=2)

I've got a hunch this has to do with the introduction of low_s (ie s = N-s if s>N//2 else s) for ECDSA signing, but can't be certain.

Can anyone point out where things are going astray?

  • Can you post a diff of your branch vs. vbuterin's? – Jimmy Song Jul 26 '16 at 1:59
  • @JimmySong git is not one of my strong suits (and currently using iOS for Python) so it's doable, but can you remind how I do a diff of my HEAD vs vbuterin's master? – Wizard Of Ozzie Jul 27 '16 at 0:08
  • git remote add vbuterin git@github.com:vbuterin/pybitcointools. Then git fetch vbuterin. Then git diff vbuterin/master. – Jimmy Song Jul 27 '16 at 13:57
1

OK, I figured it out.

It was an issue with the value of v in vrs (v being the version byte, and r/s being the DER values). Since v is not encoded by DER signatures, the check for 27 <= v <= 34 was failing because not knowing the v value would sometimes require v be equal to None, 0 or 1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.