Skip to content

Commit cd3695e

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

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
@@ -895,8 +895,9 @@ static bool onfunding_channel_tx_hook_deserialize(struct onfunding_channel_tx_ho
895895
const jsmntok_t *result_tok, *error_tok, *tx_tok;
896896

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

901902
if ((result_tok = json_get_member(buffer, toks, "result")) == NULL)
902903
fatal("Plugin returned an invalid response to the"
@@ -909,7 +910,9 @@ static bool onfunding_channel_tx_hook_deserialize(struct onfunding_channel_tx_ho
909910
toks[0].end - toks[0].start, buffer + toks[0].start);
910911

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

@@ -925,12 +928,13 @@ static char *opening_on_funding_tx(struct subd *openingd, const u8 *msg)
925928
struct onfunding_channel_tx_hook_payload *payload;
926929
payload = tal(openingd, struct onfunding_channel_tx_hook_payload);
927930
payload->cid = tal(payload, struct channel_id);
931+
payload->tx = tal(payload, struct bitcoin_tx);
928932
payload->openingd = openingd;
929933

930934
if (!fromwire_openingd_on_funding_tx(msg, msg, &payload->tx, payload->cid))
931935
return tal_fmt(tmpctx, "Unexpected encoding of openingd_on_funding_tx msg: %s",
932936
tal_hex(tmpctx, msg));
933-
assert(plugin_hook_call_onfunding_channel_tx(openingd->ld, NULL, payload));
937+
plugin_hook_call_onfunding_channel_tx(openingd->ld, NULL, payload);
934938
return NULL;
935939
}
936940

0 commit comments

Comments
 (0)