|
|
@ -466,7 +466,6 @@ int main(void) |
|
|
|
to_remote = AMOUNT_MSAT(3000000000); |
|
|
|
feerate_per_kw[LOCAL] = feerate_per_kw[REMOTE] = 15000; |
|
|
|
lchannel = new_full_channel(tmpctx, |
|
|
|
&chainparams->genesis_blockhash, |
|
|
|
&funding_txid, funding_output_index, 0, |
|
|
|
funding_amount, to_local, |
|
|
|
feerate_per_kw, |
|
|
@ -477,7 +476,6 @@ int main(void) |
|
|
|
&remote_funding_pubkey, |
|
|
|
false, LOCAL); |
|
|
|
rchannel = new_full_channel(tmpctx, |
|
|
|
&chainparams->genesis_blockhash, |
|
|
|
&funding_txid, funding_output_index, 0, |
|
|
|
funding_amount, to_remote, |
|
|
|
feerate_per_kw, |
|
|
@ -508,7 +506,7 @@ int main(void) |
|
|
|
keyset.self_htlc_key = keyset.self_payment_key; |
|
|
|
keyset.other_htlc_key = keyset.other_payment_key; |
|
|
|
|
|
|
|
raw_tx = commit_tx(tmpctx, chainparams, |
|
|
|
raw_tx = commit_tx(tmpctx, |
|
|
|
&funding_txid, funding_output_index, |
|
|
|
funding_amount, |
|
|
|
LOCAL, remote_config->to_self_delay, |
|
|
@ -519,7 +517,7 @@ int main(void) |
|
|
|
to_remote, |
|
|
|
NULL, &htlc_map, 0x2bb038521914 ^ 42, LOCAL); |
|
|
|
|
|
|
|
txs = channel_txs(tmpctx, chainparams, |
|
|
|
txs = channel_txs(tmpctx, |
|
|
|
&htlc_map, &wscripts, |
|
|
|
lchannel, &local_per_commitment_point, 42, LOCAL); |
|
|
|
assert(tal_count(txs) == 1); |
|
|
@ -528,7 +526,7 @@ int main(void) |
|
|
|
assert(scripteq(wscripts[0], funding_wscript)); |
|
|
|
tx_must_be_eq(txs[0], raw_tx); |
|
|
|
|
|
|
|
txs2 = channel_txs(tmpctx, chainparams, |
|
|
|
txs2 = channel_txs(tmpctx, |
|
|
|
&htlc_map, &wscripts, |
|
|
|
rchannel, &local_per_commitment_point, 42, REMOTE); |
|
|
|
txs_must_be_eq(txs, txs2); |
|
|
@ -556,10 +554,10 @@ int main(void) |
|
|
|
assert(lchannel->view[REMOTE].owed[REMOTE].millisatoshis |
|
|
|
== rchannel->view[LOCAL].owed[LOCAL].millisatoshis); |
|
|
|
|
|
|
|
txs = channel_txs(tmpctx, chainparams,&htlc_map, &wscripts, |
|
|
|
txs = channel_txs(tmpctx, &htlc_map, &wscripts, |
|
|
|
lchannel, &local_per_commitment_point, 42, LOCAL); |
|
|
|
assert(tal_count(txs) == 1); |
|
|
|
txs2 = channel_txs(tmpctx, chainparams, &htlc_map, &wscripts, |
|
|
|
txs2 = channel_txs(tmpctx, &htlc_map, &wscripts, |
|
|
|
rchannel, &local_per_commitment_point, 42, REMOTE); |
|
|
|
txs_must_be_eq(txs, txs2); |
|
|
|
|
|
|
@ -574,10 +572,10 @@ int main(void) |
|
|
|
assert(lchannel->view[REMOTE].owed[REMOTE].millisatoshis |
|
|
|
== rchannel->view[LOCAL].owed[LOCAL].millisatoshis); |
|
|
|
|
|
|
|
txs = channel_txs(tmpctx, chainparams, &htlc_map, &wscripts, |
|
|
|
txs = channel_txs(tmpctx, &htlc_map, &wscripts, |
|
|
|
lchannel, &local_per_commitment_point, 42, LOCAL); |
|
|
|
assert(tal_count(txs) == 6); |
|
|
|
txs2 = channel_txs(tmpctx, chainparams, &htlc_map, &wscripts, |
|
|
|
txs2 = channel_txs(tmpctx, &htlc_map, &wscripts, |
|
|
|
rchannel, &local_per_commitment_point, 42, REMOTE); |
|
|
|
txs_must_be_eq(txs, txs2); |
|
|
|
|
|
|
@ -587,7 +585,7 @@ int main(void) |
|
|
|
* output htlc_success_tx 0: 020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219700000000000000000001e8030000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402206a6e59f18764a5bf8d4fa45eebc591566689441229c918b480fb2af8cc6a4aeb02205248f273be447684b33e3c8d1d85a8e0ca9fa0bae9ae33f0527ada9c162919a60147304402207cb324fa0de88f452ffa9389678127ebcf4cabe1dd848b8e076c1a1962bf34720220116ed922b12311bd602d67e60d2529917f21c5b82f25ff6506c0f87886b4dfd5012000000000000000000000000000000000000000000000000000000000000000008a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac686800000000 |
|
|
|
*/ |
|
|
|
raw_tx = tx_from_hex(tmpctx, "020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219700000000000000000001e8030000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402206a6e59f18764a5bf8d4fa45eebc591566689441229c918b480fb2af8cc6a4aeb02205248f273be447684b33e3c8d1d85a8e0ca9fa0bae9ae33f0527ada9c162919a60147304402207cb324fa0de88f452ffa9389678127ebcf4cabe1dd848b8e076c1a1962bf34720220116ed922b12311bd602d67e60d2529917f21c5b82f25ff6506c0f87886b4dfd5012000000000000000000000000000000000000000000000000000000000000000008a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac686800000000"); |
|
|
|
raw_tx->chainparams = chainparams_for_network("bitcoin"); |
|
|
|
raw_tx->chainparams = chainparams; |
|
|
|
bitcoin_tx_input_set_witness(raw_tx, 0, NULL); |
|
|
|
tx_must_be_eq(raw_tx, txs[1]); |
|
|
|
|
|
|
@ -596,7 +594,7 @@ int main(void) |
|
|
|
* output htlc_timeout_tx 2: 020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219701000000000000000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100d5275b3619953cb0c3b5aa577f04bc512380e60fa551762ce3d7a1bb7401cff9022037237ab0dac3fe100cde094e82e2bed9ba0ed1bb40154b48e56aa70f259e608b01483045022100c89172099507ff50f4c925e6c5150e871fb6e83dd73ff9fbb72f6ce829a9633f02203a63821d9162e99f9be712a68f9e589483994feae2661e4546cd5b6cec007be501008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000 |
|
|
|
*/ |
|
|
|
raw_tx = tx_from_hex(tmpctx, "020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219701000000000000000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100d5275b3619953cb0c3b5aa577f04bc512380e60fa551762ce3d7a1bb7401cff9022037237ab0dac3fe100cde094e82e2bed9ba0ed1bb40154b48e56aa70f259e608b01483045022100c89172099507ff50f4c925e6c5150e871fb6e83dd73ff9fbb72f6ce829a9633f02203a63821d9162e99f9be712a68f9e589483994feae2661e4546cd5b6cec007be501008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000"); |
|
|
|
raw_tx->chainparams = chainparams_for_network("bitcoin"); |
|
|
|
raw_tx->chainparams = chainparams; |
|
|
|
bitcoin_tx_input_set_witness(raw_tx, 0, NULL); |
|
|
|
tx_must_be_eq(raw_tx, txs[2]); |
|
|
|
|
|
|
@ -605,7 +603,7 @@ int main(void) |
|
|
|
* output htlc_success_tx 1: 020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219702000000000000000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402201b63ec807771baf4fdff523c644080de17f1da478989308ad13a58b51db91d360220568939d38c9ce295adba15665fa68f51d967e8ed14a007b751540a80b325f20201483045022100def389deab09cee69eaa1ec14d9428770e45bcbe9feb46468ecf481371165c2f022015d2e3c46600b2ebba8dcc899768874cc6851fd1ecb3fffd15db1cc3de7e10da012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000 |
|
|
|
*/ |
|
|
|
raw_tx = tx_from_hex(tmpctx, "020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219702000000000000000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402201b63ec807771baf4fdff523c644080de17f1da478989308ad13a58b51db91d360220568939d38c9ce295adba15665fa68f51d967e8ed14a007b751540a80b325f20201483045022100def389deab09cee69eaa1ec14d9428770e45bcbe9feb46468ecf481371165c2f022015d2e3c46600b2ebba8dcc899768874cc6851fd1ecb3fffd15db1cc3de7e10da012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000"); |
|
|
|
raw_tx->chainparams = chainparams_for_network("bitcoin"); |
|
|
|
raw_tx->chainparams = chainparams; |
|
|
|
bitcoin_tx_input_set_witness(raw_tx, 0, NULL); |
|
|
|
tx_must_be_eq(raw_tx, txs[3]); |
|
|
|
|
|
|
@ -614,7 +612,7 @@ int main(void) |
|
|
|
* output htlc_timeout_tx 3: 020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219703000000000000000001b80b0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100daee1808f9861b6c3ecd14f7b707eca02dd6bdfc714ba2f33bc8cdba507bb182022026654bf8863af77d74f51f4e0b62d461a019561bb12acb120d3f7195d148a554014730440220643aacb19bbb72bd2b635bc3f7375481f5981bace78cdd8319b2988ffcc6704202203d27784ec8ad51ed3bd517a05525a5139bb0b755dd719e0054332d186ac0872701008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000 |
|
|
|
*/ |
|
|
|
raw_tx = tx_from_hex(tmpctx, "020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219703000000000000000001b80b0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100daee1808f9861b6c3ecd14f7b707eca02dd6bdfc714ba2f33bc8cdba507bb182022026654bf8863af77d74f51f4e0b62d461a019561bb12acb120d3f7195d148a554014730440220643aacb19bbb72bd2b635bc3f7375481f5981bace78cdd8319b2988ffcc6704202203d27784ec8ad51ed3bd517a05525a5139bb0b755dd719e0054332d186ac0872701008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000"); |
|
|
|
raw_tx->chainparams = chainparams_for_network("bitcoin"); |
|
|
|
raw_tx->chainparams = chainparams; |
|
|
|
bitcoin_tx_input_set_witness(raw_tx, 0, NULL); |
|
|
|
tx_must_be_eq(raw_tx, txs[4]); |
|
|
|
|
|
|
@ -623,7 +621,7 @@ int main(void) |
|
|
|
* output htlc_success_tx 4: 020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219704000000000000000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402207e0410e45454b0978a623f36a10626ef17b27d9ad44e2760f98cfa3efb37924f0220220bd8acd43ecaa916a80bd4f919c495a2c58982ce7c8625153f8596692a801d014730440220549e80b4496803cbc4a1d09d46df50109f546d43fbbf86cd90b174b1484acd5402205f12a4f995cb9bded597eabfee195a285986aa6d93ae5bb72507ebc6a4e2349e012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000 |
|
|
|
*/ |
|
|
|
raw_tx = tx_from_hex(tmpctx, "020000000001018154ecccf11a5fb56c39654c4deb4d2296f83c69268280b94d021370c94e219704000000000000000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402207e0410e45454b0978a623f36a10626ef17b27d9ad44e2760f98cfa3efb37924f0220220bd8acd43ecaa916a80bd4f919c495a2c58982ce7c8625153f8596692a801d014730440220549e80b4496803cbc4a1d09d46df50109f546d43fbbf86cd90b174b1484acd5402205f12a4f995cb9bded597eabfee195a285986aa6d93ae5bb72507ebc6a4e2349e012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000"); |
|
|
|
raw_tx->chainparams = chainparams_for_network("bitcoin"); |
|
|
|
raw_tx->chainparams = chainparams; |
|
|
|
bitcoin_tx_input_set_witness(raw_tx, 0, NULL); |
|
|
|
tx_must_be_eq(raw_tx, txs[5]); |
|
|
|
|
|
|
@ -635,18 +633,18 @@ int main(void) |
|
|
|
rchannel->view[REMOTE].feerate_per_kw = feerate_per_kw[REMOTE]; |
|
|
|
|
|
|
|
raw_tx = commit_tx( |
|
|
|
tmpctx, chainparams, &funding_txid, funding_output_index, |
|
|
|
tmpctx, &funding_txid, funding_output_index, |
|
|
|
funding_amount, LOCAL, remote_config->to_self_delay, |
|
|
|
&keyset, feerate_per_kw[LOCAL], local_config->dust_limit, |
|
|
|
to_local, to_remote, htlcs, &htlc_map, 0x2bb038521914 ^ 42, |
|
|
|
LOCAL); |
|
|
|
|
|
|
|
txs = channel_txs(tmpctx, chainparams, &htlc_map, &wscripts, |
|
|
|
txs = channel_txs(tmpctx, &htlc_map, &wscripts, |
|
|
|
lchannel, &local_per_commitment_point, 42, |
|
|
|
LOCAL); |
|
|
|
tx_must_be_eq(txs[0], raw_tx); |
|
|
|
|
|
|
|
txs2 = channel_txs(tmpctx, chainparams, &htlc_map, &wscripts, |
|
|
|
txs2 = channel_txs(tmpctx, &htlc_map, &wscripts, |
|
|
|
rchannel, &local_per_commitment_point, |
|
|
|
42, REMOTE); |
|
|
|
txs_must_be_eq(txs, txs2); |
|
|
|