mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
wally-tx: add type-to-string for a wally-tx
and then use it to print out things
This commit is contained in:
@@ -632,8 +632,17 @@ static char *fmt_bitcoin_txid(const tal_t *ctx, const struct bitcoin_txid *txid)
|
||||
return hexstr;
|
||||
}
|
||||
|
||||
static char *fmt_wally_tx(const tal_t *ctx, const struct wally_tx *tx)
|
||||
{
|
||||
u8 *lin = linearize_wtx(ctx, tx);
|
||||
char *s = tal_hex(ctx, lin);
|
||||
tal_free(lin);
|
||||
return s;
|
||||
}
|
||||
|
||||
REGISTER_TYPE_TO_STRING(bitcoin_tx, fmt_bitcoin_tx);
|
||||
REGISTER_TYPE_TO_STRING(bitcoin_txid, fmt_bitcoin_txid);
|
||||
REGISTER_TYPE_TO_STRING(wally_tx, fmt_wally_tx);
|
||||
|
||||
void fromwire_bitcoin_txid(const u8 **cursor, size_t *max,
|
||||
struct bitcoin_txid *txid)
|
||||
|
||||
@@ -37,6 +37,7 @@ union printable_types {
|
||||
const struct fee_states *fee_states;
|
||||
const char *charp_;
|
||||
const struct wally_psbt *wally_psbt;
|
||||
const struct wally_tx *wally_tx;
|
||||
};
|
||||
|
||||
#define type_to_string(ctx, type, ptr) \
|
||||
|
||||
@@ -99,8 +99,9 @@ static void wallet_withdrawal_broadcast(struct bitcoind *bitcoind UNUSED,
|
||||
was_pending(command_success(cmd, response));
|
||||
} else {
|
||||
was_pending(command_fail(cmd, LIGHTNINGD,
|
||||
"Error broadcasting transaction: %s. Unsent tx discarded",
|
||||
output));
|
||||
"Error broadcasting transaction: %s. Unsent tx discarded %s",
|
||||
output,
|
||||
type_to_string(tmpctx, struct wally_tx, txb->wtx)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user