Skip to content

Commit d9ee35c

Browse files
committed
Merge #51: fix(deps): replace deprecated FeeRate::from_sat_per_vb_unchecked
a6217bf fix(deps): replace deprecated FeeRate::from_sat_per_vb_unchecked (Noah Joeris) Pull request description: ### Description - `FeeRate::from_sat_per_vb_unchecked` got deprecated in `bitcoin-units 0.1.3`, which broke CI - I swapped it for `FeeRate::from_sat_per_vb(n)` everywhere - I went with `from_sat_per_vb` instead of `from_sat_per_vb_u32` for compatibility. `from_sat_per_vb_u32` would require a direct bitcoin-units >= 0.1.3 constraint; bitcoin only requires bitcoin-units = "0.1.0", so it can still resolve to versions without that API ACKs for top commit: ValuedMammal: ACK a6217bf Tree-SHA512: e36245370e3fdb0d79faaa12570bea1d54885bdd3af92f97523c1a77db3c033cb8be1feab58af448fb094d81b0bd32b34f483999d23bb12d395a3cb8f626891c
2 parents 8142a66 + a6217bf commit d9ee35c

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

examples/anti_fee_sniping.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() -> anyhow::Result<()> {
3939

4040
let (tip_height, tip_time) = wallet.tip_info(env.rpc_client())?;
4141
println!("Current height: {}", tip_height);
42-
let longterm_feerate = FeeRate::from_sat_per_vb_unchecked(1);
42+
let longterm_feerate = FeeRate::from_sat_per_vb(1).expect("valid fee rate");
4343

4444
let recipient_addr = env
4545
.rpc_client()
@@ -78,7 +78,7 @@ fn main() -> anyhow::Result<()> {
7878
// For waste optimization when deciding change.
7979
change_longterm_feerate: Some(longterm_feerate),
8080
..SelectorParams::new(
81-
FeeRate::from_sat_per_vb_unchecked(10),
81+
FeeRate::from_sat_per_vb(10).expect("valid fee rate"),
8282
vec![Output::with_script(
8383
recipient_addr.script_pubkey(),
8484
Amount::from_sat(50_000_000),

examples/synopsis.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() -> anyhow::Result<()> {
4040
println!("Balance (pending): {}", wallet.balance());
4141

4242
let (tip_height, tip_mtp) = wallet.tip_info(env.rpc_client())?;
43-
let longterm_feerate = FeeRate::from_sat_per_vb_unchecked(1);
43+
let longterm_feerate = FeeRate::from_sat_per_vb(1).expect("valid fee rate");
4444

4545
let recipient_addr = env
4646
.rpc_client()
@@ -58,7 +58,7 @@ fn main() -> anyhow::Result<()> {
5858
// For waste-optimization when deciding change.
5959
change_longterm_feerate: Some(longterm_feerate),
6060
..SelectorParams::new(
61-
FeeRate::from_sat_per_vb_unchecked(10),
61+
FeeRate::from_sat_per_vb(10).expect("valid fee rate"),
6262
vec![Output::with_script(
6363
recipient_addr.script_pubkey(),
6464
Amount::from_sat(21_000_000),
@@ -131,7 +131,7 @@ fn main() -> anyhow::Result<()> {
131131
SelectorParams {
132132
// This is just a lower-bound feerate. The actual result will be much higher to
133133
// satisfy mempool-replacement policy.
134-
target_feerate: FeeRate::from_sat_per_vb_unchecked(1),
134+
target_feerate: FeeRate::from_sat_per_vb(1).expect("valid fee rate"),
135135
// We cancel the tx by specifying no target outputs. This way, all excess returns
136136
// to our change output (unless if the prevouts picked are so small that it will
137137
// be less wasteful to have no output, however that will not be a valid tx).

src/selector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl RbfParams {
213213
{
214214
Self {
215215
original_txs: tx_to_replace.into_iter().map(Into::into).collect(),
216-
incremental_relay_feerate: FeeRate::from_sat_per_vb_unchecked(1),
216+
incremental_relay_feerate: FeeRate::from_sat_per_vb(1).expect("valid fee rate"),
217217
}
218218
}
219219

0 commit comments

Comments
 (0)