bitcoin: method for finding weight of 'wally_tx'

This commit is contained in:
niftynei
2021-03-03 14:51:32 -06:00
committed by Rusty Russell
parent cca6e8db03
commit 9a849d6ba6
2 changed files with 8 additions and 2 deletions

View File

@@ -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;

View File

@@ -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) */