Skip to content

Commit 01ff22e

Browse files
wip: adding channel_id and txid inside the hook
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent edcbfd6 commit 01ff22e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lightningd/opening_control.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ static void opening_got_offer(struct subd *openingd,
863863
struct onfunding_channel_tx_hook_payload {
864864
struct subd *openingd;
865865
struct bitcoin_tx *tx;
866+
struct channel_id *cid;
866867
};
867868

868869
static void onfunding_channel_tx_hook_final(struct onfunding_channel_tx_hook_payload *payload STEALS)
@@ -877,8 +878,13 @@ static void onfunding_channel_tx_hook_serialize(struct onfunding_channel_tx_hook
877878
struct json_stream *stream,
878879
struct plugin *plugin)
879880
{
881+
struct bitcoin_txid txid;
882+
883+
bitcoin_txid(payload->tx, &txid);
880884
json_object_start(stream, "onfunding_channel_tx");
881885
json_add_tx(stream, "tx", payload->tx);
886+
json_add_txid(stream, "txid", &txid);
887+
json_add_channel_id(stream, "channel_id", payload->cid);
882888
json_object_end(stream);
883889
}
884890

@@ -920,7 +926,7 @@ static char *opening_on_funding_tx(struct subd *openingd, const u8 *msg)
920926
payload = tal(openingd, struct onfunding_channel_tx_hook_payload);
921927
payload->openingd = openingd;
922928

923-
if (!fromwire_openingd_on_funding_tx(msg, msg, &payload->tx))
929+
if (!fromwire_openingd_on_funding_tx(msg, msg, &payload->tx, payload->cid))
924930
return tal_fmt(tmpctx, "Unexpected encoding of openingd_on_funding_tx msg: %s",
925931
tal_hex(tmpctx, msg));
926932
assert(plugin_hook_call_onfunding_channel_tx(openingd->ld, NULL, payload));

openingd/openingd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static bool funder_finalize_channel_setup(struct state *state,
703703
else
704704
*pbase = NULL;
705705

706-
msg = towire_openingd_on_funding_tx(tmpctx, *tx);
706+
msg = towire_openingd_on_funding_tx(tmpctx, *tx, &cid);
707707
wire_sync_write(REQ_FD, msg);
708708
msg = wire_sync_read(tmpctx, REQ_FD);
709709
if (!fromwire_openingd_on_funding_tx_reply(msg, msg, tx))

openingd/openingd_wire.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ msgdata,openingd_fundee,channel_type,channel_type,
143143
# Communicate the Funding Tx to master
144144
msgtype,openingd_on_funding_tx,6045
145145
msgdata,openingd_on_funding_tx,tx,bitcoin_tx,
146+
msgdata,openingd_on_funding_tx,channel_id,channel_id,
146147

147148
# Get a reply from master -> openingd
148149
msgtype,openingd_on_funding_tx_reply,6145

0 commit comments

Comments
 (0)