Closed Aursen closed 6 months ago
Let's change add_new_transaction
to this:
pub fn add_new_transaction(&mut self, signature: Signature, meta: TransactionMetadata) {
let capacity = self.0.capacity();
if capacity != 0 {
if self.0.len() == capacity {
self.0.shift_remove_index(0);
}
self.0.insert(signature, meta);
}
}
This checks the len against the capacity which is no longer hard-coded to 500, and at the edge case where the capacity is 0 it doesn't add any transactions
close #22