mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
ensure wallet cannot have negative balance with same block tx ordering
This commit is contained in:
parent
eb55b9420a
commit
497cf333b0
2 changed files with 11 additions and 1 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
|||
Subproject commit b7038b19f9d44cfc50af151927b06f9aada9d5e7
|
||||
Subproject commit a56f8971c022192dbce0dfc5da3c417b605e4b4f
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue