mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
WalletAppKit: Allow subclasses to fiddle with some more stuff.
This isn't really a stable or supportable API, but bitcoinj does not have a stable API, so live and let live.
This commit is contained in:
parent
80d4840199
commit
ae1e3691f5
@ -59,23 +59,23 @@ import static com.google.common.base.Preconditions.checkState;
|
|||||||
* out what went wrong more precisely. Same thing if you use the async start() method.</p>
|
* out what went wrong more precisely. Same thing if you use the async start() method.</p>
|
||||||
*/
|
*/
|
||||||
public class WalletAppKit extends AbstractIdleService {
|
public class WalletAppKit extends AbstractIdleService {
|
||||||
private final String filePrefix;
|
protected final String filePrefix;
|
||||||
private final NetworkParameters params;
|
protected final NetworkParameters params;
|
||||||
private volatile BlockChain vChain;
|
protected volatile BlockChain vChain;
|
||||||
private volatile SPVBlockStore vStore;
|
protected volatile SPVBlockStore vStore;
|
||||||
private volatile Wallet vWallet;
|
protected volatile Wallet vWallet;
|
||||||
private volatile PeerGroup vPeerGroup;
|
protected volatile PeerGroup vPeerGroup;
|
||||||
|
|
||||||
private final File directory;
|
protected final File directory;
|
||||||
private volatile File vWalletFile;
|
protected volatile File vWalletFile;
|
||||||
|
|
||||||
private boolean useAutoSave = true;
|
protected boolean useAutoSave = true;
|
||||||
private PeerAddress[] peerAddresses;
|
protected PeerAddress[] peerAddresses;
|
||||||
private PeerEventListener downloadListener;
|
protected PeerEventListener downloadListener;
|
||||||
private boolean autoStop = true;
|
protected boolean autoStop = true;
|
||||||
private InputStream checkpoints;
|
protected InputStream checkpoints;
|
||||||
private boolean blockingStartup = true;
|
protected boolean blockingStartup = true;
|
||||||
private String userAgent, version;
|
protected String userAgent, version;
|
||||||
|
|
||||||
public WalletAppKit(NetworkParameters params, File directory, String filePrefix) {
|
public WalletAppKit(NetworkParameters params, File directory, String filePrefix) {
|
||||||
this.params = checkNotNull(params);
|
this.params = checkNotNull(params);
|
||||||
@ -199,7 +199,7 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
||||||
}
|
}
|
||||||
vChain = new BlockChain(params, vStore);
|
vChain = new BlockChain(params, vStore);
|
||||||
vPeerGroup = new PeerGroup(params, vChain);
|
vPeerGroup = createPeerGroup();
|
||||||
if (this.userAgent != null)
|
if (this.userAgent != null)
|
||||||
vPeerGroup.setUserAgent(userAgent, version);
|
vPeerGroup.setUserAgent(userAgent, version);
|
||||||
if (vWalletFile.exists()) {
|
if (vWalletFile.exists()) {
|
||||||
@ -256,6 +256,10 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected PeerGroup createPeerGroup() {
|
||||||
|
return new PeerGroup(params, vChain);
|
||||||
|
}
|
||||||
|
|
||||||
private void installShutdownHook() {
|
private void installShutdownHook() {
|
||||||
if (autoStop) Runtime.getRuntime().addShutdownHook(new Thread() {
|
if (autoStop) Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user