Skip to content

Commit 2a930e2

Browse files
tx: decode the tx
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent cdb4242 commit 2a930e2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

common/json_parse.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ bool json_to_txid(const char *buffer, const jsmntok_t *tok,
584584
bool json_to_tx(const char *buffer, const jsmntok_t *tok,
585585
struct bitcoin_tx *tx)
586586
{
587-
tx = bitcoin_tx_from_hex(buffer, buffer + tok->start, tok->end - tok->start);
587+
tx = bitcoin_tx_from_hex(buffer, buffer + tok->start,
588+
tok->end - tok->start);
588589
return tx != NULL;
589590
}
590591

lightningd/opening_control.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,12 @@ static bool onfunding_channel_tx_hook_deserialize(struct onfunding_channel_tx_ho
909909
" onfunding_channel_tx hook: %.*s",
910910
toks[0].end - toks[0].start, buffer + toks[0].start);
911911

912+
payload->tx = NULL;
912913
if (!json_to_tx(buffer, tx_tok, payload->tx))
913914
fatal("Plugin returned an invalid (json to tx) response to the"
914915
" onfunding_channel_tx hook: %.*s",
915916
tx_tok[0].end - tx_tok[0].start, buffer + tx_tok[0].start);
917+
log_info(payload->openingd->log, "hook return the following tx: %s", fmt_bitcoin_tx(tmpctx, payload->tx));
916918
return true;
917919
}
918920

0 commit comments

Comments
 (0)