mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
handle failure to retrieve broadcasted transaction from mempool, allow retry
This commit is contained in:
parent
a440c22455
commit
702d92d4f2
1 changed files with 8 additions and 0 deletions
|
@ -815,6 +815,7 @@ public class HeadersController extends TransactionFormController implements Init
|
|||
transactionMempoolService = new ElectrumServer.TransactionMempoolService(headersForm.getSigningWallet(), headersForm.getTransaction().getTxId(), headersForm.getSigningWalletNodes());
|
||||
transactionMempoolService.setDelay(Duration.seconds(3));
|
||||
transactionMempoolService.setPeriod(Duration.seconds(10));
|
||||
transactionMempoolService.setRestartOnFailure(false);
|
||||
transactionMempoolService.setOnSucceeded(mempoolWorkerStateEvent -> {
|
||||
Set<String> scriptHashes = transactionMempoolService.getValue();
|
||||
if(!scriptHashes.isEmpty()) {
|
||||
|
@ -829,6 +830,13 @@ public class HeadersController extends TransactionFormController implements Init
|
|||
broadcastButton.setDisable(false);
|
||||
}
|
||||
});
|
||||
transactionMempoolService.setOnFailed(mempoolWorkerStateEvent -> {
|
||||
transactionMempoolService.cancel();
|
||||
broadcastProgressBar.setProgress(0);
|
||||
log.error("Timeout searching for broadcasted transaction");
|
||||
AppServices.showErrorDialog("Timeout searching for broadcasted transaction", "The transaction was broadcast but the server did not indicate it had entered the mempool. It is safe to try broadcasting again.");
|
||||
broadcastButton.setDisable(false);
|
||||
});
|
||||
transactionMempoolService.start();
|
||||
} else {
|
||||
Sha256Hash txid = headersForm.getTransaction().getTxId();
|
||||
|
|
Loading…
Reference in a new issue