URI: 
       ttransaction.py: sign_txin. allow override for get_preimage_script. test_commitment_tx_with_all_five_HTLCs_untrimmed_minimum_feerate now passes - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit fd7469745e56fa53307b48c35b59a77516051b93
   DIR parent 4d41299f1ca0af2852b95692ddf0b043042881e5
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon, 23 Apr 2018 13:52:20 +0200
       
       ttransaction.py: sign_txin. allow override for get_preimage_script.
       ttest_commitment_tx_with_all_five_HTLCs_untrimmed_minimum_feerate now passes
       
       Diffstat:
         M lib/lnbase.py                       |      13 ++++++-------
         M lib/tests/test_lnbase.py            |     152 ++++++++++++++++++-------------
       
       2 files changed, 96 insertions(+), 69 deletions(-)
       ---
   DIR diff --git a/lib/lnbase.py b/lib/lnbase.py
       t@@ -358,27 +358,26 @@ def make_htlc_tx_witness(remotehtlcsig, localhtlcsig, payment_preimage, witness_
            assert type(localhtlcsig) is bytes
            assert type(payment_preimage) is bytes
            assert type(witness_script) is bytes
       -    return bfh(var_int(5) + '00' + ''.join([witness_push(x) for x in [bh2u(remotehtlcsig), bh2u(localhtlcsig), bh2u(payment_preimage), bh2u(witness_script)]]))
       +    return bfh(var_int(5) + '00' + ''.join([witness_push(bh2u(x)) for x in [remotehtlcsig, localhtlcsig, payment_preimage, witness_script]]))
        
       -def make_htlc_tx_inputs(htlc_output_txid, htlc_output_index, revocationpubkey, local_delayedpubkey, amount_msat, witness, pubkeys, sigs):
       +def make_htlc_tx_inputs(htlc_output_txid, htlc_output_index, revocationpubkey, local_delayedpubkey, amount_msat, witness_script):
            assert type(htlc_output_txid) is str
            assert type(htlc_output_index) is int
            assert type(revocationpubkey) is bytes
            assert type(local_delayedpubkey) is bytes
            assert type(amount_msat) is int
       -    assert type(witness) is bytes
       +    assert type(witness_script) is str
            c_inputs = [{
                'scriptSig': '',
                'type': 'p2wsh',
       -        'x_pubkeys': [bh2u(x) for x in pubkeys],
       -        'signatures': sigs,
       -        'num_sig': 2,
       +        'signatures': [],
       +        'num_sig': 0,
                'prevout_n': htlc_output_index,
                'prevout_hash': htlc_output_txid,
                'value': amount_msat // 1000,
                'coinbase': False,
                'sequence': 0x0,
       -        'witness': bh2u(witness)
       +        'preimage_script': witness_script,
            }]
            return c_inputs
        
   DIR diff --git a/lib/tests/test_lnbase.py b/lib/tests/test_lnbase.py
       t@@ -102,39 +102,38 @@ class Test_LNBase(unittest.TestCase):
                remote_htlcpubkey = remotepubkey
                local_htlcpubkey = localpubkey
        
       +        htlc2_cltv_timeout = 502
                htlc2_payment_preimage = b"\x02" * 32
                htlc2 = make_offered_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc2_payment_preimage)
                # HTLC 2 offered amount 2000
       -        # wscript 
                ref_htlc2_wscript = "76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868"
                self.assertEqual(htlc2, bfh(ref_htlc2_wscript))
        
       +        htlc3_cltv_timeout = 503
                htlc3_payment_preimage = b"\x03" * 32
                htlc3 = make_offered_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc3_payment_preimage)
                # HTLC 3 offered amount 3000 
       -        # wscript 
                ref_htlc3_wscript = "76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868"
                self.assertEqual(htlc3, bfh(ref_htlc3_wscript))
        
       +        htlc0_cltv_timeout = 500
                htlc0_payment_preimage = b"\x00" * 32
       -        htlc0 = make_received_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc0_payment_preimage, 500)
       +        htlc0 = make_received_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc0_payment_preimage, htlc0_cltv_timeout)
                # HTLC 0 received amount 1000
       -        # wscript
                ref_htlc0_wscript = "76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac6868"
                self.assertEqual(htlc0, bfh(ref_htlc0_wscript))
        
       -        htlc1_cltv_expiry = 501
       +        htlc1_cltv_timeout = 501
                htlc1_payment_preimage = b"\x01" * 32
       -        htlc1 = make_received_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc1_payment_preimage, htlc1_cltv_expiry)
       +        htlc1 = make_received_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc1_payment_preimage, htlc1_cltv_timeout)
                # HTLC 1 received amount 2000 
       -        # wscript 
                ref_htlc1_wscript = "76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6868"
                self.assertEqual(htlc1, bfh(ref_htlc1_wscript))
        
       +        htlc4_cltv_timeout = 504
                htlc4_payment_preimage = b"\x04" * 32
       -        htlc4 = make_received_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc4_payment_preimage, 504)
       +        htlc4 = make_received_htlc(local_revocation_pubkey, remote_htlcpubkey, local_htlcpubkey, htlc4_payment_preimage, htlc4_cltv_timeout)
                # HTLC 4 received amount 4000 
       -        # wscript 
                ref_htlc4_wscript = "76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868"
                self.assertEqual(htlc4, bfh(ref_htlc4_wscript))
        
       t@@ -144,11 +143,11 @@ class Test_LNBase(unittest.TestCase):
                # local_signature = 30440220275b0c325a5e9355650dc30c0eccfbc7efb23987c24b556b9dfdd40effca18d202206caceb2c067836c51f296740c7ae807ffcbfbf1dd3a0d56b6de9a5b247985f06
parazyd.org:70 /git/electrum/commit/fd7469745e56fa53307b48c35b59a77516051b93.gph:108: line too long