mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +00:00
WalletAppKit: Allow setting of the user agent.
This commit is contained in:
parent
6342af0913
commit
60ba7120db
@ -75,6 +75,7 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
private boolean autoStop = true;
|
private boolean autoStop = true;
|
||||||
private InputStream checkpoints;
|
private InputStream checkpoints;
|
||||||
private boolean blockingStartup = true;
|
private boolean blockingStartup = true;
|
||||||
|
private 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);
|
||||||
@ -127,7 +128,7 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
* block sync faster for new users - please refer to the documentation on the bitcoinj website for further details.
|
* block sync faster for new users - please refer to the documentation on the bitcoinj website for further details.
|
||||||
*/
|
*/
|
||||||
public WalletAppKit setCheckpoints(InputStream checkpoints) {
|
public WalletAppKit setCheckpoints(InputStream checkpoints) {
|
||||||
this.checkpoints = checkpoints;
|
this.checkpoints = checkNotNull(checkpoints);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +143,17 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the string that will appear in the subver field of the version message.
|
||||||
|
* @param userAgent A short string that should be the name of your app, e.g. "My Wallet"
|
||||||
|
* @param version A short string that contains the version number, e.g. "1.0-BETA"
|
||||||
|
*/
|
||||||
|
public WalletAppKit setUserAgent(String userAgent, String version) {
|
||||||
|
this.userAgent = checkNotNull(userAgent);
|
||||||
|
this.version = checkNotNull(version);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Override this to load all wallet extensions if any are necessary.</p>
|
* <p>Override this to load all wallet extensions if any are necessary.</p>
|
||||||
*
|
*
|
||||||
@ -188,6 +200,8 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
}
|
}
|
||||||
vChain = new BlockChain(params, vStore);
|
vChain = new BlockChain(params, vStore);
|
||||||
vPeerGroup = new PeerGroup(params, vChain);
|
vPeerGroup = new PeerGroup(params, vChain);
|
||||||
|
if (this.userAgent != null)
|
||||||
|
vPeerGroup.setUserAgent(userAgent, version);
|
||||||
if (vWalletFile.exists()) {
|
if (vWalletFile.exists()) {
|
||||||
walletStream = new FileInputStream(vWalletFile);
|
walletStream = new FileInputStream(vWalletFile);
|
||||||
vWallet = new Wallet(params);
|
vWallet = new Wallet(params);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user