mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 08:04:26 +01:00
close_tx: don't use protobufs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -26,7 +26,8 @@ int main(int argc, char *argv[])
|
||||
OpenAnchor *a;
|
||||
struct bitcoin_tx *close_tx;
|
||||
struct bitcoin_signature sig1, sig2;
|
||||
struct pubkey pubkey1, pubkey2;
|
||||
struct pubkey pubkey1, pubkey2, final1, final2;
|
||||
struct sha256_double anchor_txid;
|
||||
u8 *redeemscript;
|
||||
CloseChannel *close;
|
||||
CloseChannelComplete *closecomplete;
|
||||
@@ -59,6 +60,12 @@ int main(int argc, char *argv[])
|
||||
if (!proto_to_pubkey(secp256k1_context_create(0),
|
||||
o2->commit_key, &pubkey2))
|
||||
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. */
|
||||
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);
|
||||
|
||||
/* 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),
|
||||
ctx, o1, o2, a,
|
||||
ctx, &final1, &final2,
|
||||
&anchor_txid, a->output_index, a->amount,
|
||||
cstate->a.pay_msat / 1000,
|
||||
cstate->b.pay_msat / 1000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user