Skip to content

Commit 0e7e41e

Browse files
tx: decode the tx
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent bbaa0d6 commit 0e7e41e

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
@@ -911,10 +911,12 @@ static bool onfunding_channel_tx_hook_deserialize(struct onfunding_channel_tx_ho
911911
" onfunding_channel_tx hook: %.*s",
912912
toks[0].end - toks[0].start, buffer + toks[0].start);
913913

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

0 commit comments

Comments
 (0)