@@ -30,7 +30,7 @@ pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
30
30
31
31
pub use lightning_invoice:: Bolt11Invoice ;
32
32
33
- pub use bitcoin:: { Address , BlockHash , Network , OutPoint , Txid } ;
33
+ pub use bitcoin:: { Address , BlockHash , FeeRate , Network , OutPoint , Txid } ;
34
34
35
35
pub use bip39:: Mnemonic ;
36
36
@@ -51,7 +51,6 @@ use lightning::util::ser::Writeable;
51
51
use lightning_invoice:: SignedRawBolt11Invoice ;
52
52
53
53
use std:: convert:: TryInto ;
54
- use std:: fmt;
55
54
use std:: str:: FromStr ;
56
55
57
56
impl UniffiCustomTypeConverter for PublicKey {
@@ -346,61 +345,3 @@ impl UniffiCustomTypeConverter for NodeAlias {
346
345
obj. to_string ( )
347
346
}
348
347
}
349
-
350
- /// Represents fee rate.
351
- ///
352
- /// This is a simple wrapper around [`bitcoin::FeeRate`], only used for UniFFI bindings.
353
- #[ derive( Debug , Clone , Copy , Eq , PartialEq ) ]
354
- pub struct FeeRate ( pub ( crate ) bitcoin:: FeeRate ) ;
355
-
356
- impl FeeRate {
357
- /// Constructs `FeeRate` from satoshis per 1000 weight units.
358
- pub const fn from_sat_per_kwu ( sat_kwu : u64 ) -> Self {
359
- Self ( bitcoin:: FeeRate :: from_sat_per_kwu ( sat_kwu) )
360
- }
361
-
362
- /// Constructs `FeeRate` from satoshis per virtual bytes.
363
- ///
364
- /// # Errors
365
- ///
366
- /// Returns [`FeeRateError::ConversionError`] on arithmetic overflow.
367
- pub fn from_sat_per_vb ( sat_vb : u64 ) -> Result < Self , FeeRateError > {
368
- Ok ( Self ( bitcoin:: FeeRate :: from_sat_per_vb ( sat_vb) . ok_or ( FeeRateError :: ConversionError ) ?) )
369
- }
370
-
371
- /// Constructs `FeeRate` from satoshis per virtual bytes without overflow check.
372
- pub const fn from_sat_per_vb_unchecked ( sat_vb : u64 ) -> Self {
373
- Self ( bitcoin:: FeeRate :: from_sat_per_vb_unchecked ( sat_vb) )
374
- }
375
-
376
- /// Returns raw fee rate as satoshis per 1000 weight units.
377
- pub const fn as_sat_per_kwu ( & self ) -> u64 {
378
- self . 0 . to_sat_per_kwu ( )
379
- }
380
-
381
- /// Converts to sat/vB rounding down.
382
- pub const fn as_sat_per_vb_floor ( & self ) -> u64 {
383
- self . 0 . to_sat_per_vb_floor ( )
384
- }
385
-
386
- /// Converts to sat/vB rounding up.
387
- pub const fn as_sat_per_vb_ceil ( self ) -> u64 {
388
- self . 0 . to_sat_per_vb_ceil ( )
389
- }
390
- }
391
-
392
- #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
393
- /// A fee rate error that possibly needs to be handled by the user.
394
- pub enum FeeRateError {
395
- ConversionError ,
396
- }
397
-
398
- impl std:: error:: Error for FeeRateError { }
399
-
400
- impl fmt:: Display for FeeRateError {
401
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
402
- match self {
403
- Self :: ConversionError => write ! ( f, "Fee-rate conversion failed." ) ,
404
- }
405
- }
406
- }
0 commit comments