mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-01 12:31:23 +00:00
When testing for specific network, use network ID.
This commit is contained in:
@@ -264,7 +264,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
this.context = context;
|
||||
this.params = context.getParams();
|
||||
this.keychain = checkNotNull(keyChainGroup);
|
||||
if (params == UnitTestParams.get())
|
||||
if (params.getId().equals(NetworkParameters.ID_UNITTESTNET))
|
||||
this.keychain.setLookaheadSize(5); // Cut down excess computation for unit tests.
|
||||
// If this keychain was created fresh just now (new wallet), make HD so a backup can be made immediately
|
||||
// without having to call current/freshReceiveKey. If there are already keys in the chain of any kind then
|
||||
@@ -3438,7 +3438,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
*/
|
||||
public Transaction createSend(Address address, Coin value) throws InsufficientMoneyException {
|
||||
SendRequest req = SendRequest.to(address, value);
|
||||
if (params == UnitTestParams.get())
|
||||
if (params.getId().equals(NetworkParameters.ID_UNITTESTNET))
|
||||
req.shuffleOutputs = false;
|
||||
completeTx(req);
|
||||
return req.tx;
|
||||
|
@@ -318,7 +318,7 @@ public class WalletAppKit extends AbstractIdleService {
|
||||
for (PeerAddress addr : peerAddresses) vPeerGroup.addAddress(addr);
|
||||
vPeerGroup.setMaxConnections(peerAddresses.length);
|
||||
peerAddresses = null;
|
||||
} else if (params != RegTestParams.get() && !useTor) {
|
||||
} else if (!params.getId().equals(NetworkParameters.ID_REGTEST) && !useTor) {
|
||||
vPeerGroup.addPeerDiscovery(discovery != null ? discovery : new DnsDiscovery(params));
|
||||
}
|
||||
vChain.addWallet(vWallet);
|
||||
|
@@ -85,6 +85,6 @@ public class DefaultCoinSelector implements CoinSelector {
|
||||
confidence.getSource().equals(TransactionConfidence.Source.SELF) &&
|
||||
// In regtest mode we expect to have only one peer, so we won't see transactions propagate.
|
||||
// TODO: The value 1 below dates from a time when transactions we broadcast *to* were counted, set to 0
|
||||
(confidence.numBroadcastPeers() > 1 || tx.getParams() == RegTestParams.get());
|
||||
(confidence.numBroadcastPeers() > 1 || tx.getParams().getId().equals(NetworkParameters.ID_REGTEST));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user