From d03c1451892a7b4914ec72a6e165527b7a5663fd Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sun, 24 Apr 2022 17:41:24 +0100 Subject: [PATCH] Added to testRegisterNameFeeIncrease() test to catch the recently detected bug. --- src/test/java/org/qortal/test/naming/MiscTests.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/qortal/test/naming/MiscTests.java b/src/test/java/org/qortal/test/naming/MiscTests.java index 8252453c..2bcd098d 100644 --- a/src/test/java/org/qortal/test/naming/MiscTests.java +++ b/src/test/java/org/qortal/test/naming/MiscTests.java @@ -356,8 +356,15 @@ public class MiscTests extends Common { UnitFeesByTimestamp pastFeeIncrease = new UnitFeesByTimestamp(); pastFeeIncrease.timestamp = now - 1000L; // 1 second ago pastFeeIncrease.fee = new AmountTypeAdapter().unmarshal("3"); - FieldUtils.writeField(BlockChain.getInstance(), "nameRegistrationUnitFees", Arrays.asList(pastFeeIncrease), true); + + // Set another increase in the future + futureFeeIncrease = new UnitFeesByTimestamp(); + futureFeeIncrease.timestamp = now + (60 * 60 * 1000L); // 1 hour in the future + futureFeeIncrease.fee = new AmountTypeAdapter().unmarshal("10"); + + FieldUtils.writeField(BlockChain.getInstance(), "nameRegistrationUnitFees", Arrays.asList(pastFeeIncrease, futureFeeIncrease), true); assertEquals(pastFeeIncrease.fee, BlockChain.getInstance().getNameRegistrationUnitFeeAtTimestamp(pastFeeIncrease.timestamp)); + assertEquals(futureFeeIncrease.fee, BlockChain.getInstance().getNameRegistrationUnitFeeAtTimestamp(futureFeeIncrease.timestamp)); // Register a different name // First try with the default unit fee