mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
WalletTemplate: don't override default PeerGroup params as they should be appropriate out of the box. Propagate WAK startup errors to the UI.
This commit is contained in:
parent
101ad83906
commit
71e9a2d4b2
@ -1,9 +1,9 @@
|
|||||||
package wallettemplate;
|
package wallettemplate;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.*;
|
||||||
import org.bitcoinj.core.NetworkParameters;
|
import org.bitcoinj.core.NetworkParameters;
|
||||||
import org.bitcoinj.kits.WalletAppKit;
|
import org.bitcoinj.kits.WalletAppKit;
|
||||||
import org.bitcoinj.params.RegTestParams;
|
import org.bitcoinj.params.*;
|
||||||
import org.bitcoinj.params.TestNet3Params;
|
|
||||||
import org.bitcoinj.utils.BriefLogFormatter;
|
import org.bitcoinj.utils.BriefLogFormatter;
|
||||||
import org.bitcoinj.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import org.bitcoinj.wallet.DeterministicSeed;
|
import org.bitcoinj.wallet.DeterministicSeed;
|
||||||
@ -29,7 +29,7 @@ import static wallettemplate.utils.GuiUtils.*;
|
|||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
public static String APP_NAME = "WalletTemplate";
|
public static String APP_NAME = "WalletTemplate";
|
||||||
|
|
||||||
public static NetworkParameters params = TestNet3Params.get();
|
public static NetworkParameters params = MainNetParams.get();
|
||||||
public static WalletAppKit bitcoin;
|
public static WalletAppKit bitcoin;
|
||||||
public static Main instance;
|
public static Main instance;
|
||||||
|
|
||||||
@ -95,20 +95,23 @@ public class Main extends Application {
|
|||||||
|
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
|
||||||
|
bitcoin.addListener(new Service.Listener() {
|
||||||
|
@Override
|
||||||
|
public void failed(Service.State from, Throwable failure) {
|
||||||
|
GuiUtils.crashAlert(failure);
|
||||||
|
}
|
||||||
|
}, Platform::runLater);
|
||||||
bitcoin.startAsync();
|
bitcoin.startAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupWalletKit(@Nullable DeterministicSeed seed) {
|
public void setupWalletKit(@Nullable DeterministicSeed seed) {
|
||||||
// If seed is non-null it means we are restoring from backup.
|
// If seed is non-null it means we are restoring from backup.
|
||||||
bitcoin = new WalletAppKit(params, new File("."), APP_NAME) {
|
bitcoin = new WalletAppKit(params, new File("."), APP_NAME + "-" + params.getPaymentProtocolId()) {
|
||||||
@Override
|
@Override
|
||||||
protected void onSetupCompleted() {
|
protected void onSetupCompleted() {
|
||||||
// Don't make the user wait for confirmations for now, as the intention is they're sending it
|
// Don't make the user wait for confirmations for now, as the intention is they're sending it
|
||||||
// their own money!
|
// their own money!
|
||||||
bitcoin.wallet().allowSpendingUnconfirmedTransactions();
|
bitcoin.wallet().allowSpendingUnconfirmedTransactions();
|
||||||
if (params != RegTestParams.get())
|
|
||||||
bitcoin.peerGroup().setMaxConnections(11);
|
|
||||||
bitcoin.peerGroup().setBloomFilterFalsePositiveRate(0.00001);
|
|
||||||
Platform.runLater(controller::onBitcoinSetup);
|
Platform.runLater(controller::onBitcoinSetup);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user