@@ -16,6 +16,7 @@ use hashes::sha256d;
16
16
use internals:: { compact_size, write_err, ToU64 } ;
17
17
use io:: { BufRead , Write } ;
18
18
use primitives:: Sequence ;
19
+ use units:: NumOpResult ;
19
20
20
21
use super :: Weight ;
21
22
use crate :: consensus:: { self , encode, Decodable , Encodable } ;
@@ -27,7 +28,6 @@ use crate::script::{Script, ScriptBuf, ScriptExt as _, ScriptExtPriv as _};
27
28
use crate :: sighash:: { EcdsaSighashType , TapSighashType } ;
28
29
use crate :: witness:: Witness ;
29
30
use crate :: { Amount , FeeRate , SignedAmount } ;
30
- use units:: NumOpResult ;
31
31
32
32
#[ rustfmt:: skip] // Keep public re-exports separate.
33
33
#[ doc( inline) ]
@@ -786,10 +786,7 @@ pub fn effective_value(
786
786
) -> NumOpResult < SignedAmount > {
787
787
let weight = input_weight_prediction. total_weight ( ) ;
788
788
789
- fee_rate
790
- . to_fee ( weight)
791
- . map ( Amount :: to_signed)
792
- . and_then ( |fee| value. to_signed ( ) - fee) // Cannot overflow.
789
+ fee_rate. to_fee ( weight) . map ( Amount :: to_signed) . and_then ( |fee| value. to_signed ( ) - fee) // Cannot overflow.
793
790
}
794
791
795
792
/// Predicts the weight of a to-be-constructed transaction.
@@ -1943,7 +1940,7 @@ mod tests {
1943
1940
// needless_borrows_for_generic_args incorrecctly identifies &[] as a needless borrow
1944
1941
#[ allow( clippy:: needless_borrows_for_generic_args) ]
1945
1942
fn weight_prediction_new ( ) {
1946
- let p2wpkh_max = InputWeightPrediction :: new ( 0 , [ 72 , 33 ] ) ;
1943
+ let p2wpkh_max = InputWeightPrediction :: new ( 0 , [ 72 , 33 ] ) ;
1947
1944
assert_eq ! ( p2wpkh_max. script_size, 1 ) ;
1948
1945
assert_eq ! ( p2wpkh_max. witness_size, 108 ) ;
1949
1946
assert_eq ! ( p2wpkh_max. total_weight( ) , Weight :: from_wu( 272 ) ) ;
0 commit comments