ensure wallet cannot have negative balance with same block tx ordering

This commit is contained in:
Craig Raw
2021-04-12 15:47:45 +02:00
parent eb55b9420a
commit 497cf333b0
2 changed files with 11 additions and 1 deletions
@@ -155,6 +155,16 @@ public class TransactionEntry extends Entry implements Comparable<TransactionEnt
@Override
public int compareTo(TransactionEntry other) {
int blockOrder = blockTransaction.compareBlockOrder(other.blockTransaction);
if(blockOrder != 0) {
return blockOrder;
}
int valueOrder = Long.compare(other.getValue(), getValue());
if(valueOrder != 0) {
return valueOrder;
}
return blockTransaction.compareTo(other.blockTransaction);
}