mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 20:11:23 +00:00
Transaction.SORT_TX_BY_HEIGHT: Use the Block.BLOCK_HEIGHT_UNKNOWN constant rather than -1.
This commit is contained in:
@@ -80,10 +80,10 @@ public class Transaction extends ChildMessage {
|
||||
public int compare(final Transaction tx1, final Transaction tx2) {
|
||||
final TransactionConfidence confidence1 = tx1.getConfidence();
|
||||
final int height1 = confidence1.getConfidenceType() == ConfidenceType.BUILDING
|
||||
? confidence1.getAppearedAtChainHeight() : -1;
|
||||
? confidence1.getAppearedAtChainHeight() : Block.BLOCK_HEIGHT_UNKNOWN;
|
||||
final TransactionConfidence confidence2 = tx2.getConfidence();
|
||||
final int height2 = confidence2.getConfidenceType() == ConfidenceType.BUILDING
|
||||
? confidence2.getAppearedAtChainHeight() : -1;
|
||||
? confidence2.getAppearedAtChainHeight() : Block.BLOCK_HEIGHT_UNKNOWN;
|
||||
final int heightComparison = -(Ints.compare(height1, height2));
|
||||
//If height1==height2, compare by tx hash to make comparator consistent with equals
|
||||
return heightComparison != 0 ? heightComparison : tx1.getHash().compareTo(tx2.getHash());
|
||||
|
Reference in New Issue
Block a user