Fix the known issue with the DSA

I wrote it to only select TXs with a timelock, not only TXs which are unlocked.
This most likely explains why it so heavily selected coinbases.

Also moves an InternalError which would've never been hit on mainnet, yet
technically isn't an invariant, to only exist when cfg(test).
This commit is contained in:
Luke Parker
2023-07-04 18:07:27 -04:00
parent 89eef95fb3
commit b195db0929
3 changed files with 20 additions and 13 deletions

View File

@@ -273,7 +273,11 @@ impl<O: Clone + Zeroize> Timelocked<O> {
/// Returns None if the Timelocks aren't comparable. Returns Some(vec![]) if none are unlocked.
pub fn unlocked(&self, timelock: Timelock) -> Option<Vec<O>> {
// If the Timelocks are comparable, return the outputs if they're now unlocked
self.0.partial_cmp(&timelock).filter(|_| self.0 <= timelock).map(|_| self.1.clone())
if self.0 <= timelock {
Some(self.1.clone())
} else {
None
}
}
pub fn ignore_timelock(&self) -> Vec<O> {