Don't scan outputs which are dust, track dust change as operating costs

Fixes #299.
This commit is contained in:
Luke Parker
2023-10-19 08:02:10 -04:00
parent d833254b84
commit 7b2dec63ce
8 changed files with 70 additions and 22 deletions

View File

@@ -26,14 +26,14 @@ use crate::{
#[rustfmt::skip]
// https://github.com/bitcoin/bitcoin/blob/306ccd4927a2efe325c8d84be1bdb79edeb29b04/src/policy/policy.h#L27
const MAX_STANDARD_TX_WEIGHT: u64 = 400_000;
pub const MAX_STANDARD_TX_WEIGHT: u64 = 400_000;
#[rustfmt::skip]
// https://github.com/bitcoin/bitcoin/blob/306ccd4927a2efe325c8d84be1bdb79edeb29b04/src/policy/policy.cpp#L26-L63
// As the above notes, a lower amount may not be considered dust if contained in a SegWit output
// This doesn't bother with delineation due to how marginal these values are, and because it isn't
// worth the complexity to implement differentation
const DUST: u64 = 546;
pub const DUST: u64 = 546;
#[rustfmt::skip]
// The constant is from:
@@ -44,7 +44,7 @@ const DUST: u64 = 546;
// https://github.com/bitcoin/bitcoin/blob/296735f7638749906243c9e203df7bd024493806/src/net_processing.cpp#L5721-L5732
// And then the fee itself is fee per thousand units, not fee per unit
// https://github.com/bitcoin/bitcoin/blob/306ccd4927a2efe325c8d84be1bdb79edeb29b04/src/policy/feerate.cpp#L23-L37
const MIN_FEE_PER_KILO_VSIZE: u64 = 1000;
pub const MIN_FEE_PER_KILO_VSIZE: u64 = 1000;
#[derive(Clone, PartialEq, Eq, Debug, Error)]
pub enum TransactionError {