mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-11 09:08:02 +00:00
ensure wallet cannot have negative balance with same block tx ordering
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user