walletfx/WalletApplication: fix context not initialized

This commit is contained in:
Sean Gilligan 2022-08-09 12:30:00 -07:00 committed by Andreas Schildbach
parent 9708b4cad9
commit 51efbcb98c

View file

@ -22,6 +22,7 @@ import javafx.scene.input.KeyCombination;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.bitcoinj.base.BitcoinNetwork; import org.bitcoinj.base.BitcoinNetwork;
import org.bitcoinj.base.ScriptType; import org.bitcoinj.base.ScriptType;
import org.bitcoinj.core.Context;
import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Utils; import org.bitcoinj.core.Utils;
import org.bitcoinj.kits.WalletAppKit; import org.bitcoinj.kits.WalletAppKit;
@ -129,6 +130,7 @@ public abstract class WalletApplication implements AppDelegate {
} }
protected void startWalletAppKit(Stage primaryStage) throws IOException { protected void startWalletAppKit(Stage primaryStage) throws IOException {
Context.propagate(new Context());
// Tell bitcoinj to run event handlers on the JavaFX UI thread. This keeps things simple and means // Tell bitcoinj to run event handlers on the JavaFX UI thread. This keeps things simple and means
// we cannot forget to switch threads when adding event handlers. Unfortunately, the DownloadListener // we cannot forget to switch threads when adding event handlers. Unfortunately, the DownloadListener
// we give to the app kit is currently an exception and runs on a library thread. It'll get fixed in // we give to the app kit is currently an exception and runs on a library thread. It'll get fixed in