|
@ -26,7 +26,8 @@ int main(int argc, char *argv[]) |
|
|
OpenAnchor *a; |
|
|
OpenAnchor *a; |
|
|
struct bitcoin_tx *close_tx; |
|
|
struct bitcoin_tx *close_tx; |
|
|
struct bitcoin_signature sig1, sig2; |
|
|
struct bitcoin_signature sig1, sig2; |
|
|
struct pubkey pubkey1, pubkey2; |
|
|
struct pubkey pubkey1, pubkey2, final1, final2; |
|
|
|
|
|
struct sha256_double anchor_txid; |
|
|
u8 *redeemscript; |
|
|
u8 *redeemscript; |
|
|
CloseChannel *close; |
|
|
CloseChannel *close; |
|
|
CloseChannelComplete *closecomplete; |
|
|
CloseChannelComplete *closecomplete; |
|
@ -59,6 +60,12 @@ int main(int argc, char *argv[]) |
|
|
if (!proto_to_pubkey(secp256k1_context_create(0), |
|
|
if (!proto_to_pubkey(secp256k1_context_create(0), |
|
|
o2->commit_key, &pubkey2)) |
|
|
o2->commit_key, &pubkey2)) |
|
|
errx(1, "Invalid o2 commit_key"); |
|
|
errx(1, "Invalid o2 commit_key"); |
|
|
|
|
|
if (!proto_to_pubkey(secp256k1_context_create(0), |
|
|
|
|
|
o1->final_key, &final1)) |
|
|
|
|
|
errx(1, "Invalid o1 final pubkey"); |
|
|
|
|
|
if (!proto_to_pubkey(secp256k1_context_create(0), |
|
|
|
|
|
o2->final_key, &final2)) |
|
|
|
|
|
errx(1, "Invalid o2 final pubkey"); |
|
|
|
|
|
|
|
|
/* Get delta by accumulting all the updates. */ |
|
|
/* Get delta by accumulting all the updates. */ |
|
|
cstate = gather_updates(ctx, o1, o2, a, close->close_fee, argv + 6, |
|
|
cstate = gather_updates(ctx, o1, o2, a, close->close_fee, argv + 6, |
|
@ -68,8 +75,10 @@ int main(int argc, char *argv[]) |
|
|
redeemscript = bitcoin_redeem_2of2(ctx, &pubkey1, &pubkey2); |
|
|
redeemscript = bitcoin_redeem_2of2(ctx, &pubkey1, &pubkey2); |
|
|
|
|
|
|
|
|
/* Now create the close tx to spend 2/2 output of anchor. */ |
|
|
/* Now create the close tx to spend 2/2 output of anchor. */ |
|
|
|
|
|
proto_to_sha256(a->txid, &anchor_txid.sha); |
|
|
close_tx = create_close_tx(secp256k1_context_create(0), |
|
|
close_tx = create_close_tx(secp256k1_context_create(0), |
|
|
ctx, o1, o2, a, |
|
|
ctx, &final1, &final2, |
|
|
|
|
|
&anchor_txid, a->output_index, a->amount, |
|
|
cstate->a.pay_msat / 1000, |
|
|
cstate->a.pay_msat / 1000, |
|
|
cstate->b.pay_msat / 1000); |
|
|
cstate->b.pay_msat / 1000); |
|
|
|
|
|
|
|
|