Default birthday for ARRR moved to "arrrDefaultBirthday" (default 2000000).

This allows users to increase their default birthday if they know that no wallets were created before a certain block, to reduce sync time. It also fixed some failed unit tests that relied on transactions between blocks 1900000 and 2000000.
This commit is contained in:
CalDescent 2022-08-13 16:48:03 +01:00
parent b46c3cf95f
commit 9debebe03e
6 changed files with 14 additions and 11 deletions

View File

@ -26,8 +26,6 @@ public class PirateChain extends Bitcoiny {
public static final String CURRENCY_CODE = "ARRR";
public static final int DEFAULT_BIRTHDAY = 2000000;
private static final Coin DEFAULT_FEE_PER_KB = Coin.valueOf(10000); // 0.0001 ARRR per 1000 bytes
private static final long MINIMUM_ORDER_AMOUNT = 10000; // 0.0001 ARRR minimum order, to avoid dust errors // TODO: increase this

View File

@ -14,14 +14,13 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.qortal.settings.Settings;
import org.qortal.transform.TransformationException;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static org.qortal.crosschain.PirateChain.DEFAULT_BIRTHDAY;
/** Pirate Chain network support for querying Bitcoiny-related info like block headers, transaction outputs, etc. */
public class PirateLightClient extends BitcoinyBlockchainProvider {
@ -470,8 +469,9 @@ public class PirateLightClient extends BitcoinyBlockchainProvider {
public List<BitcoinyTransaction> getAddressBitcoinyTransactions(String address, boolean includeUnconfirmed) throws ForeignBlockchainException {
try {
// Firstly we need to get the latest block
int defaultBirthday = Settings.getInstance().getArrrDefaultBirthday();
BlockID endBlock = this.getCompactTxStreamerStub().getLatestBlock(null);
BlockID startBlock = BlockID.newBuilder().setHeight(DEFAULT_BIRTHDAY).build();
BlockID startBlock = BlockID.newBuilder().setHeight(defaultBirthday).build();
BlockRange blockRange = BlockRange.newBuilder().setStart(startBlock).setEnd(endBlock).build();
TransparentAddressBlockFilter blockFilter = TransparentAddressBlockFilter.newBuilder()

View File

@ -25,8 +25,6 @@ import java.util.Collection;
import java.util.Objects;
import java.util.Random;
import static org.qortal.crosschain.PirateChain.DEFAULT_BIRTHDAY;
public class PirateWallet {
protected static final Logger LOGGER = LogManager.getLogger(PirateWallet.class);
@ -87,7 +85,7 @@ public class PirateWallet {
if (wallet == null) {
// Wallet doesn't exist, so create a new one
int birthday = DEFAULT_BIRTHDAY;
int birthday = Settings.getInstance().getArrrDefaultBirthday();
if (this.isNullSeedWallet) {
try {
// Attempt to set birthday to the current block for null seed wallets

View File

@ -238,9 +238,11 @@ public class Settings {
/** Whether to show SysTray pop-up notifications when trade-bot entries change state */
private boolean tradebotSystrayEnabled = false;
/** Wallets path - used for storing enrppted wallet caches for coins that require them */
/** Wallets path - used for storing encrypted wallet caches for coins that require them */
private String walletsPath = "wallets";
private int arrrDefaultBirthday = 2000000;
// Repository related
/** Queries that take longer than this are logged. (milliseconds) */
private Long slowQueryThreshold = null;
@ -729,6 +731,10 @@ public class Settings {
return this.walletsPath;
}
public int getArrrDefaultBirthday() {
return this.arrrDefaultBirthday;
}
public boolean isTradebotSystrayEnabled() {
return this.tradebotSystrayEnabled;
}

View File

@ -28,7 +28,7 @@ public class PirateChainTests extends Common {
@Before
public void beforeTest() throws DataException {
Common.useDefaultSettings(); // TestNet3
Common.useDefaultSettings();
pirateChain = PirateChain.getInstance();
}

View File

@ -15,5 +15,6 @@
"tempDataPath": "data-test/_temp",
"listsPath": "lists-test",
"storagePolicy": "FOLLOWED_OR_VIEWED",
"maxStorageCapacity": 104857600
"maxStorageCapacity": 104857600,
"arrrDefaultBirthday": 1900000
}