@@ -150,6 +150,9 @@ pub enum PsbtCmd<S: clap::Args> {
150
150
value : u64 ,
151
151
/// Recipient address
152
152
address : Address < NetworkUnchecked > ,
153
+ /// Set the feerate of the tx (sat/vbyte)
154
+ #[ clap( long, short, default_value = "1.0" ) ]
155
+ feerate : Option < f32 > ,
153
156
/// Set max absolute timelock (from consensus value)
154
157
#[ clap( long, short) ]
155
158
after : Option < u32 > ,
@@ -260,6 +263,7 @@ pub fn create_tx<O: ChainOracle>(
260
263
cs_algorithm : CoinSelectionAlgo ,
261
264
address : Address ,
262
265
value : u64 ,
266
+ feerate : f32 ,
263
267
) -> anyhow:: Result < ( Psbt , Option < ChangeInfo > ) >
264
268
where
265
269
O :: Error : std:: error:: Error + Send + Sync + ' static ,
@@ -332,7 +336,10 @@ where
332
336
. iter ( )
333
337
. map ( |output| ( output. weight ( ) . to_wu ( ) as u32 , output. value . to_sat ( ) ) ) ,
334
338
) ,
335
- fee : TargetFee :: default ( ) ,
339
+ fee : TargetFee {
340
+ rate : FeeRate :: from_sat_per_vb ( feerate) ,
341
+ ..Default :: default ( )
342
+ } ,
336
343
} ;
337
344
338
345
let change_policy = ChangePolicy {
@@ -584,6 +591,7 @@ pub fn handle_commands<CS: clap::Subcommand, S: clap::Args>(
584
591
PsbtCmd :: New {
585
592
value,
586
593
address,
594
+ feerate,
587
595
after,
588
596
older,
589
597
coin_select,
@@ -611,7 +619,15 @@ pub fn handle_commands<CS: clap::Subcommand, S: clap::Args>(
611
619
assets = assets. older ( relative:: LockTime :: from_consensus ( n) ?) ;
612
620
}
613
621
614
- create_tx ( & mut graph, & * chain, & assets, coin_select, address, value) ?
622
+ create_tx (
623
+ & mut graph,
624
+ & * chain,
625
+ & assets,
626
+ coin_select,
627
+ address,
628
+ value,
629
+ feerate. expect ( "must have feerate" ) ,
630
+ ) ?
615
631
} ;
616
632
617
633
if let Some ( ChangeInfo {
0 commit comments