Fix for off-by-one bug when ATs look for next transaction. Currently configured to take effect block 275,000

This commit is contained in:
catbref
2021-01-17 16:01:36 +00:00
parent e5bb3e2f0a
commit d336200d75
4 changed files with 23 additions and 5 deletions

View File

@@ -146,7 +146,11 @@ public class QortalATAPI extends API {
String atAddress = this.atData.getATAddress();
int height = timestamp.blockHeight;
int sequence = timestamp.transactionSequence + 1;
int sequence = timestamp.transactionSequence;
if (state.getCurrentBlockHeight() < BlockChain.getInstance().getAtFindNextTransactionFixHeight())
// Off-by-one bug still in effect
sequence += 1;
ATRepository.NextTransactionInfo nextTransactionInfo;
try {

View File

@@ -70,6 +70,7 @@ public class BlockChain {
private GenesisBlock.GenesisInfo genesisInfo;
public enum FeatureTrigger {
atFindNextTransactionFix;
}
/** Map of which blockchain features are enabled when (height/timestamp) */
@@ -371,6 +372,10 @@ public class BlockChain {
// Convenience methods for specific blockchain feature triggers
public int getAtFindNextTransactionFixHeight() {
return this.featureTriggers.get(FeatureTrigger.atFindNextTransactionFix.name()).intValue();
}
// More complex getters for aspects that change by height or timestamp
public long getRewardAtHeight(int ourHeight) {