Skip to content

Commit 4281420

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

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
@@ -861,6 +861,7 @@ static void opening_got_offer(struct subd *openingd,
861861
struct onfunding_channel_tx_hook_payload {
862862
struct subd *openingd;
863863
struct bitcoin_tx *tx;
864+
struct channel_id *cid;
864865
};
865866

866867
static void onfunding_channel_tx_hook_final(struct onfunding_channel_tx_hook_payload *payload STEALS)
@@ -875,8 +876,13 @@ static void onfunding_channel_tx_hook_serialize(struct onfunding_channel_tx_hook
875876
struct json_stream *stream,
876877
struct plugin *plugin)
877878
{
879+
struct bitcoin_txid txid;
880+
881+
bitcoin_txid(payload->tx, &txid);
878882
json_object_start(stream, "onfunding_channel_tx");
879883
json_add_tx(stream, "tx", payload->tx);
884+
json_add_txid(stream, "txid", &txid);
885+
json_add_channel_id(stream, "channel_id", payload->cid);
880886
json_object_end(stream);
881887
}
882888

@@ -918,7 +924,7 @@ static char *opening_on_funding_tx(struct subd *openingd, const u8 *msg)
918924
payload = tal(openingd, struct onfunding_channel_tx_hook_payload);
919925
payload->openingd = openingd;
920926

921-
if (!fromwire_openingd_on_funding_tx(msg, msg, &payload->tx))
927+
if (!fromwire_openingd_on_funding_tx(msg, msg, &payload->tx, payload->cid))
922928
return tal_fmt(tmpctx, "Unexpected encoding of openingd_on_funding_tx msg: %s",
923929
tal_hex(tmpctx, msg));
924930
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)