Skip to content

Commit c495a95

Browse files
committed
remove some deprecated weight-related methods
1 parent 68d3507 commit c495a95

File tree

6 files changed

+13
-38
lines changed

6 files changed

+13
-38
lines changed

fuzz/fuzz_targets/deserialize_block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ mod tests {
3939
for (idx, c) in hex.as_bytes().iter().enumerate() {
4040
b <<= 4;
4141
match *c {
42-
b'A'...b'F' => b |= c - b'A' + 10,
43-
b'a'...b'f' => b |= c - b'a' + 10,
44-
b'0'...b'9' => b |= c - b'0',
42+
b'A'..=b'F' => b |= c - b'A' + 10,
43+
b'a'..=b'f' => b |= c - b'a' + 10,
44+
b'0'..=b'9' => b |= c - b'0',
4545
_ => panic!("Bad hex"),
4646
}
4747
if (idx & 1) == 1 {

fuzz/fuzz_targets/deserialize_output.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ mod tests {
4545
for (idx, c) in hex.as_bytes().iter().enumerate() {
4646
b <<= 4;
4747
match *c {
48-
b'A'...b'F' => b |= c - b'A' + 10,
49-
b'a'...b'f' => b |= c - b'a' + 10,
50-
b'0'...b'9' => b |= c - b'0',
48+
b'A'..=b'F' => b |= c - b'A' + 10,
49+
b'a'..=b'f' => b |= c - b'a' + 10,
50+
b'0'..=b'9' => b |= c - b'0',
5151
_ => panic!("Bad hex"),
5252
}
5353
if (idx & 1) == 1 {

fuzz/fuzz_targets/deserialize_pset.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ mod tests {
4141
for (idx, c) in hex.as_bytes().iter().enumerate() {
4242
b <<= 4;
4343
match *c {
44-
b'A'...b'F' => b |= c - b'A' + 10,
45-
b'a'...b'f' => b |= c - b'a' + 10,
46-
b'0'...b'9' => b |= c - b'0',
44+
b'A'..=b'F' => b |= c - b'A' + 10,
45+
b'a'..=b'f' => b |= c - b'a' + 10,
46+
b'0'..=b'9' => b |= c - b'0',
4747
_ => panic!("Bad hex"),
4848
}
4949
if (idx & 1) == 1 {

fuzz/fuzz_targets/deserialize_transaction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn do_test(data: &[u8]) {
99
let reser = elements::encode::serialize(&tx);
1010
assert_eq!(data, &reser[..]);
1111
let len = reser.len();
12-
let calculated_weight = tx.get_weight();
12+
let calculated_weight = tx.weight();
1313
for input in &mut tx.input {
1414
input.witness = elements::TxInWitness::default();
1515
}
@@ -58,9 +58,9 @@ mod tests {
5858
for (idx, c) in hex.as_bytes().iter().enumerate() {
5959
b <<= 4;
6060
match *c {
61-
b'A'...b'F' => b |= c - b'A' + 10,
62-
b'a'...b'f' => b |= c - b'a' + 10,
63-
b'0'...b'9' => b |= c - b'0',
61+
b'A'..=b'F' => b |= c - b'A' + 10,
62+
b'a'..=b'f' => b |= c - b'a' + 10,
63+
b'0'..=b'9' => b |= c - b'0',
6464
_ => panic!("Bad hex"),
6565
}
6666
if (idx & 1) == 1 {

src/block.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,6 @@ impl Block {
364364
self.header.block_hash()
365365
}
366366

367-
/// Get the size of the block
368-
#[deprecated(since = "0.19.1", note = "Please use `Block::size` instead.")]
369-
pub fn get_size(&self) -> usize {
370-
self.size()
371-
}
372-
373367
/// Get the size of the block
374368
pub fn size(&self) -> usize {
375369
// The size of the header + the size of the varint with the tx count + the txs themselves
@@ -378,12 +372,6 @@ impl Block {
378372
base_size + txs_size
379373
}
380374

381-
/// Get the weight of the block
382-
#[deprecated(since = "0.19.1", note = "Please use `Block::weight` instead.")]
383-
pub fn get_weight(&self) -> usize {
384-
self.weight()
385-
}
386-
387375
/// Get the weight of the block
388376
pub fn weight(&self) -> usize {
389377
let base_weight = 4 * (serialize(&self.header).len() + VarInt(self.txdata.len() as u64).size());

src/transaction.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -896,25 +896,12 @@ impl Transaction {
896896
self.output.iter().any(|o| !o.witness.is_empty())
897897
}
898898

899-
/// Get the "weight" of this transaction; roughly equivalent to BIP141, in that witness data is
900-
/// counted as 1 while non-witness data is counted as 4.
901-
#[deprecated(since = "0.19.1", note = "Please use `Transaction::weight` instead.")]
902-
pub fn get_weight(&self) -> usize {
903-
self.weight()
904-
}
905-
906899
/// Get the "weight" of this transaction; roughly equivalent to BIP141, in that witness data is
907900
/// counted as 1 while non-witness data is counted as 4.
908901
pub fn weight(&self) -> usize {
909902
self.scaled_size(4)
910903
}
911904

912-
/// Gets the regular byte-wise consensus-serialized size of this transaction.
913-
#[deprecated(since = "0.19.1", note = "Please use `Transaction::size` instead.")]
914-
pub fn get_size(&self) -> usize {
915-
self.size()
916-
}
917-
918905
/// Gets the regular byte-wise consensus-serialized size of this transaction.
919906
pub fn size(&self) -> usize {
920907
self.scaled_size(1)

0 commit comments

Comments
 (0)