Implementing review suggestions from afilini

This commit is contained in:
Richard Ulrich
2020-10-22 09:11:58 +02:00
parent 759f6eac43
commit 49894ffa6d
3 changed files with 140 additions and 63 deletions

View File

@@ -82,6 +82,12 @@ pub enum FeePolicy {
FeeAmount(u64),
}
impl std::default::Default for FeePolicy {
fn default() -> Self {
FeePolicy::FeeRate(FeeRate::default_min_relay_fee())
}
}
// Unfortunately derive doesn't work with `PhantomData`: https://github.com/rust-lang/rust/issues/26925
impl<D: Database, Cs: CoinSelectionAlgorithm<D>> Default for TxBuilder<D, Cs>
where
@@ -315,14 +321,6 @@ impl<D: Database, Cs: CoinSelectionAlgorithm<D>> TxBuilder<D, Cs> {
phantom: PhantomData,
}
}
/// Returns true if an absolute fee was specified
pub fn has_absolute_fee(&self) -> bool {
if self.fee_policy.is_none() {
return false;
};
matches!(self.fee_policy.as_ref().unwrap(), FeePolicy::FeeAmount(_))
}
}
/// Ordering of the transaction's inputs and outputs