From cca5bac30ae2e258827e8315f905aba4eaf40fcc Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sun, 24 Apr 2022 15:36:36 +0100 Subject: [PATCH] Fixed logic bug in name registration fee calculation. --- src/main/java/org/qortal/block/BlockChain.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/qortal/block/BlockChain.java b/src/main/java/org/qortal/block/BlockChain.java index 86a00574..bc06fadf 100644 --- a/src/main/java/org/qortal/block/BlockChain.java +++ b/src/main/java/org/qortal/block/BlockChain.java @@ -425,9 +425,8 @@ public class BlockChain { } public long getNameRegistrationUnitFeeAtTimestamp(long ourTimestamp) { - // Scan through for reward at our height - for (int i = 0; i < nameRegistrationUnitFees.size(); ++i) - if (ourTimestamp >= nameRegistrationUnitFees.get(i).timestamp) + for (int i = nameRegistrationUnitFees.size() - 1; i >= 0; --i) + if (nameRegistrationUnitFees.get(i).timestamp <= ourTimestamp) return nameRegistrationUnitFees.get(i).fee; // Default to system-wide unit fee