Commit 8bf5ed86 authored by Andreas Schildbach's avatar Andreas Schildbach

BlockchainService: Double the capacity of the block store.

parent 026c1611
......@@ -26,6 +26,7 @@ import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.TestNet3Params;
import org.bitcoinj.script.Script;
import org.bitcoinj.store.SPVBlockStore;
import org.bitcoinj.utils.MonetaryFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -104,6 +105,9 @@ public final class Constants {
/** Filename of the block store for storing the chain. */
public static final String BLOCKCHAIN_FILENAME = "blockchain" + FILENAME_NETWORK_SUFFIX;
/** Capacity of the block store. */
public static final int BLOCKCHAIN_STORE_CAPACITY = SPVBlockStore.DEFAULT_CAPACITY * 2;
/** Filename of the block checkpoints file. */
public static final String CHECKPOINTS_FILENAME = "checkpoints" + FILENAME_NETWORK_SUFFIX + ".txt";
......
......@@ -543,7 +543,8 @@ public class BlockchainService extends LifecycleService {
}
try {
blockStore = new SPVBlockStore(Constants.NETWORK_PARAMETERS, blockChainFile);
blockStore = new SPVBlockStore(Constants.NETWORK_PARAMETERS, blockChainFile,
Constants.Files.BLOCKCHAIN_STORE_CAPACITY, true);
blockStore.getChainHead(); // detect corruptions as early as possible
final long earliestKeyCreationTime = wallet.getEarliestKeyCreationTime();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment