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

@@ -745,9 +745,8 @@ impl<D: Db, N: Network> MultisigManager<D, N> {
res.push((key, id, tx, eventuality));
}
// TODO: If the TX is None, restore its inputs to the scheduler
// Otherwise, if the TX had a change output, dropping its inputs would burn funds
// Are there exceptional cases upon rotation?
// TODO: If the TX is None, restore its inputs to the scheduler for efficiency's sake
// If this TODO is removed, also reduce the operating costs
}
res
};

View File

@@ -553,7 +553,9 @@ impl<N: Network, D: Db> Scanner<N, D> {
// TODO: These lines are the ones which will cause a really long-lived lock acquisiton
for output in network.get_outputs(&block, key).await {
assert_eq!(output.key(), key);
outputs.push(output);
if output.amount() >= N::DUST {
outputs.push(output);
}
}
for (id, (block_number, tx)) in network

View File

@@ -435,6 +435,7 @@ impl<N: Network> Scheduler<N> {
let mut remainder = diff - (per_payment * payments_len);
for payment in payments.iter_mut() {
// TODO: This usage of saturating_sub is invalid as we *need* to subtract this value
payment.amount = payment.amount.saturating_sub(per_payment + remainder);
// Only subtract the remainder once
remainder = 0;