Skip to content

Commit 7a522ab

Browse files
fixup! wip: opening control notify the tx to master
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent d639864 commit 7a522ab

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lightningd/opening_control.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,9 @@ static bool onfunding_channel_tx_hook_deserialize(struct onfunding_channel_tx_ho
893893
const jsmntok_t *result_tok, *error_tok, *tx_tok;
894894

895895
if ((error_tok = json_get_member(buffer, toks, "error")) != NULL)
896-
/*FIXME(bitfinix): please return an error to openingd*/
897-
return false;
896+
fatal("Plugin returned an error inside the response to the"
897+
" onfunding_channel_tx hook: %.*s",
898+
toks[0].end - toks[0].start, buffer + toks[0].start);
898899

899900
if ((result_tok = json_get_member(buffer, toks, "result")) == NULL)
900901
fatal("Plugin returned an invalid response to the"
@@ -907,7 +908,9 @@ static bool onfunding_channel_tx_hook_deserialize(struct onfunding_channel_tx_ho
907908
toks[0].end - toks[0].start, buffer + toks[0].start);
908909

909910
if (!json_to_tx(buffer, tx_tok, payload->tx))
910-
return false;
911+
fatal("Plugin returned an invalid response to the"
912+
" onfunding_channel_tx hook: %.*s",
913+
toks[0].end - toks[0].start, buffer + toks[0].start);
911914
return true;
912915
}
913916

@@ -923,12 +926,13 @@ static char *opening_on_funding_tx(struct subd *openingd, const u8 *msg)
923926
struct onfunding_channel_tx_hook_payload *payload;
924927
payload = tal(openingd, struct onfunding_channel_tx_hook_payload);
925928
payload->cid = tal(payload, struct channel_id);
929+
payload->tx = tal(payload, struct bitcoin_tx);
926930
payload->openingd = openingd;
927931

928932
if (!fromwire_openingd_on_funding_tx(msg, msg, &payload->tx, payload->cid))
929933
return tal_fmt(tmpctx, "Unexpected encoding of openingd_on_funding_tx msg: %s",
930934
tal_hex(tmpctx, msg));
931-
assert(plugin_hook_call_onfunding_channel_tx(openingd->ld, NULL, payload));
935+
plugin_hook_call_onfunding_channel_tx(openingd->ld, NULL, payload);
932936
return NULL;
933937
}
934938

0 commit comments

Comments
 (0)