Skip to content

Commit eccf30d

Browse files
committed
chore(api): use Weight in favor of u64 on Tx
1 parent 97b543d commit eccf30d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/api.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub struct Tx {
126126
/// The [`Transaction`] size in raw bytes (NOT virtual bytes).
127127
pub size: usize,
128128
/// The [`Transaction`]'s weight units.
129-
pub weight: u64,
129+
pub weight: Weight,
130130
/// The confirmation status of the [`Transaction`].
131131
pub status: TxStatus,
132132
/// The fee amount paid by the [`Transaction`], in satoshis.
@@ -411,11 +411,6 @@ impl Tx {
411411
})
412412
.collect()
413413
}
414-
415-
/// Get the weight of a [`Tx`].
416-
pub fn weight(&self) -> Weight {
417-
Weight::from_wu(self.weight)
418-
}
419414
}
420415

421416
fn deserialize_witness<'de, D>(d: D) -> Result<Vec<Vec<u8>>, D::Error>

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ mod test {
574574
assert_eq!(tx_info.txid, txid);
575575
assert_eq!(tx_info.to_tx(), tx_exp);
576576
assert_eq!(tx_info.size, tx_exp.total_size());
577-
assert_eq!(tx_info.weight(), tx_exp.weight());
577+
assert_eq!(tx_info.weight, tx_exp.weight());
578578
assert_eq!(tx_info.fee, tx_res.fee.unwrap().unsigned_abs());
579579
assert!(tx_info.status.confirmed);
580580
assert_eq!(tx_info.status.block_height, Some(tx_block_height));

0 commit comments

Comments
 (0)