Skip to content

Commit

Permalink
bitcoin: method for finding weight of 'wally_tx'
Browse files Browse the repository at this point in the history
  • Loading branch information
niftynei authored and rustyrussell committed Mar 9, 2021
1 parent cca6e8d commit 9a849d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bitcoin/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions bitcoin/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down

0 comments on commit 9a849d6

Please sign in to comment.