URI: 
       tbitcoin.py: fix op_push - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 44bb1e9993bbfe996bf4263e787da184f9f5bc87
   DIR parent 6cf334244a7147130c56ba98b5a28a17d86187f9
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Sat, 14 Apr 2018 16:13:51 +0200
       
       bitcoin.py: fix op_push
       
       https://github.com/bitcoin/bitcoin/blob/8cbc5c4be4be22aca228074f087a374a7ec38be8/src/script/script.h#L464
       https://github.com/btcsuite/btcd/blob/fdc2bc867bda6b351191b5872d2da8270df00d13/txscript/scriptbuilder.go#L151
       
       Diffstat:
         M lib/bitcoin.py                      |       6 +++---
         M lib/tests/test_bitcoin.py           |       4 ++--
       
       2 files changed, 5 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/lib/bitcoin.py b/lib/bitcoin.py
       t@@ -166,11 +166,11 @@ def var_int(i):
        
        
        def op_push(i):
       -    if i<0x4c:
       +    if i<0x4c:  # OP_PUSHDATA1
                return int_to_hex(i)
       -    elif i<0xff:
       +    elif i<=0xff:
                return '4c' + int_to_hex(i)
       -    elif i<0xffff:
       +    elif i<=0xffff:
                return '4d' + int_to_hex(i,2)
            else:
                return '4e' + int_to_hex(i,4)
   DIR diff --git a/lib/tests/test_bitcoin.py b/lib/tests/test_bitcoin.py
       t@@ -142,11 +142,11 @@ class Test_bitcoin(unittest.TestCase):
                self.assertEqual(op_push(0x4b), '4b')
                self.assertEqual(op_push(0x4c), '4c4c')
                self.assertEqual(op_push(0xfe), '4cfe')
       -        self.assertEqual(op_push(0xff), '4dff00')
       +        self.assertEqual(op_push(0xff), '4cff')
                self.assertEqual(op_push(0x100), '4d0001')
                self.assertEqual(op_push(0x1234), '4d3412')
                self.assertEqual(op_push(0xfffe), '4dfeff')
       -        self.assertEqual(op_push(0xffff), '4effff0000')
       +        self.assertEqual(op_push(0xffff), '4dffff')
                self.assertEqual(op_push(0x10000), '4e00000100')
                self.assertEqual(op_push(0x12345678), '4e78563412')