|
1 | 1 | use alloc::{vec, vec::Vec}; |
2 | 2 | use core::fmt; |
3 | | -use core::ops::Deref; |
4 | 3 |
|
5 | 4 | use bdk_coin_select::{metrics::LowestFee, Candidate, NoBnbSolution}; |
6 | 5 | use bitcoin::{absolute, FeeRate, OutPoint}; |
@@ -241,51 +240,6 @@ impl<E: fmt::Display> fmt::Display for IntoSelectionError<E> { |
241 | 240 | #[cfg(feature = "std")] |
242 | 241 | impl<E: fmt::Debug + fmt::Display> std::error::Error for IntoSelectionError<E> {} |
243 | 242 |
|
244 | | -/// Occurs when we are missing outputs. |
245 | | -#[derive(Debug)] |
246 | | -pub struct MissingOutputs(HashSet<OutPoint>); |
247 | | - |
248 | | -impl Deref for MissingOutputs { |
249 | | - type Target = HashSet<OutPoint>; |
250 | | - |
251 | | - fn deref(&self) -> &Self::Target { |
252 | | - &self.0 |
253 | | - } |
254 | | -} |
255 | | - |
256 | | -impl fmt::Display for MissingOutputs { |
257 | | - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
258 | | - // TODO: should not use fmt::Debug on Display |
259 | | - write!(f, "missing outputs: {:?}", self.0) |
260 | | - } |
261 | | -} |
262 | | - |
263 | | -#[cfg(feature = "std")] |
264 | | -impl std::error::Error for MissingOutputs {} |
265 | | - |
266 | | -/// Occurs when a must-select policy cannot be fulfilled. |
267 | | -#[derive(Debug)] |
268 | | -pub enum PolicyFailure<PF> { |
269 | | - /// Missing outputs. |
270 | | - MissingOutputs(MissingOutputs), |
271 | | - /// Policy failure. |
272 | | - PolicyFailure(PF), |
273 | | -} |
274 | | - |
275 | | -impl<PF: fmt::Display> fmt::Display for PolicyFailure<PF> { |
276 | | - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
277 | | - match self { |
278 | | - PolicyFailure::MissingOutputs(err) => write!(f, "{err}"), |
279 | | - PolicyFailure::PolicyFailure(err) => { |
280 | | - write!(f, "policy failure: {err}") |
281 | | - } |
282 | | - } |
283 | | - } |
284 | | -} |
285 | | - |
286 | | -#[cfg(feature = "std")] |
287 | | -impl<PF: fmt::Debug + fmt::Display> std::error::Error for PolicyFailure<PF> {} |
288 | | - |
289 | 243 | /// Select for lowest fee with bnb |
290 | 244 | pub fn selection_algorithm_lowest_fee_bnb( |
291 | 245 | longterm_feerate: FeeRate, |
|
0 commit comments