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

2
drongo

@ -1 +1 @@
Subproject commit b7038b19f9d44cfc50af151927b06f9aada9d5e7
Subproject commit a56f8971c022192dbce0dfc5da3c417b605e4b4f

View file

@ -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);
}