From 9a849d6ba6ceda1ff6824424424b94fa2d2d8edd Mon Sep 17 00:00:00 2001 From: niftynei Date: Wed, 3 Mar 2021 14:51:32 -0600 Subject: [PATCH] bitcoin: method for finding weight of 'wally_tx' --- bitcoin/tx.c | 9 +++++++-- bitcoin/tx.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bitcoin/tx.c b/bitcoin/tx.c index 6be607b74..f6fb836de 100644 --- a/bitcoin/tx.c +++ b/bitcoin/tx.c @@ -443,14 +443,19 @@ u8 *linearize_wtx(const tal_t *ctx, const struct wally_tx *wtx) return arr; } -size_t bitcoin_tx_weight(const struct bitcoin_tx *tx) +size_t wally_tx_weight(const struct wally_tx *wtx) { size_t weight; - int ret = wally_tx_get_weight(tx->wtx, &weight); + int ret = wally_tx_get_weight(wtx, &weight); assert(ret == WALLY_OK); return weight; } +size_t bitcoin_tx_weight(const struct bitcoin_tx *tx) +{ + return wally_tx_weight(tx->wtx); +} + void wally_txid(const struct wally_tx *wtx, struct bitcoin_txid *txid) { u8 *arr; diff --git a/bitcoin/tx.h b/bitcoin/tx.h index 40d7f6969..3ebac3f4a 100644 --- a/bitcoin/tx.h +++ b/bitcoin/tx.h @@ -59,6 +59,7 @@ u8 *linearize_wtx(const tal_t *ctx, const struct wally_tx *wtx); /* Get weight of tx in Sipa. */ size_t bitcoin_tx_weight(const struct bitcoin_tx *tx); +size_t wally_tx_weight(const struct wally_tx *wtx); /* Allocate a tx: you just need to fill in inputs and outputs (they're * zeroed with inputs' sequence_number set to FFFFFFFF) */