mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Delay callback of tx broadcaster
This commit is contained in:
parent
1b7db08e68
commit
7f0e871007
@ -10,7 +10,7 @@ public class DevEnv {
|
||||
// peer (click user icon and alt+r), filter/block offers by various data like offer ID (cmd + f).
|
||||
// The user can set a program argument to ignore all of those privileged network_messages. They are intended for
|
||||
// emergency cases only (beside update message and arbitrator registration).
|
||||
public static final boolean USE_DEV_PRIVILEGE_KEYS = false;
|
||||
public static final boolean USE_DEV_PRIVILEGE_KEYS = true;
|
||||
public static final String DEV_PRIVILEGE_PUB_KEY = "027a381b5333a56e1cc3d90d3a7d07f26509adf7029ed06fc997c656621f8da1ee";
|
||||
public static final String DEV_PRIVILEGE_PRIV_KEY = "6ac43ea1df2a290c1c8391736aa42e4339c5cb4f110ff0257a13b63211977b7a";
|
||||
|
||||
@ -18,7 +18,7 @@ public class DevEnv {
|
||||
// If set to true we ignore several UI behavior like confirmation popups as well dummy accounts are created and
|
||||
// offers are filled with default values. Intended to make dev testing faster.
|
||||
@SuppressWarnings("PointlessBooleanExpression")
|
||||
public static final boolean DEV_MODE = STRESS_TEST_MODE || false;
|
||||
public static final boolean DEV_MODE = STRESS_TEST_MODE || true;
|
||||
|
||||
public static final boolean DAO_PHASE2_ACTIVATED = false;
|
||||
public static final boolean DAO_TRADING_ACTIVATED = false;
|
||||
|
@ -316,22 +316,28 @@ public abstract class WalletService {
|
||||
Futures.addCallback(peerGroup.broadcastTransaction(tx).future(), new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable Transaction result) {
|
||||
if (broadcastTimers.containsKey(tx.getHashAsString())) {
|
||||
// If the timeout has not been called we call the callback.onSuccess
|
||||
timeoutTimer.stop();
|
||||
broadcastTimers.remove(tx.getHashAsString());
|
||||
callback.onSuccess(tx);
|
||||
} else {
|
||||
// Timeout was triggered, nothing to do anymore.
|
||||
log.info("onSuccess for tx {} was already called from timeout handler. ", tx.getHashAsString());
|
||||
}
|
||||
// At regtest we get called immediately back but we want to make sure that the handler is not called
|
||||
// before the caller is finished.
|
||||
UserThread.execute(() -> {
|
||||
if (broadcastTimers.containsKey(tx.getHashAsString())) {
|
||||
// If the timeout has not been called we call the callback.onSuccess
|
||||
timeoutTimer.stop();
|
||||
broadcastTimers.remove(tx.getHashAsString());
|
||||
callback.onSuccess(tx);
|
||||
} else {
|
||||
// Timeout was triggered, nothing to do anymore.
|
||||
log.info("onSuccess for tx {} was already called from timeout handler. ", tx.getHashAsString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable t) {
|
||||
timeoutTimer.stop();
|
||||
broadcastTimers.remove(tx.getHashAsString());
|
||||
callback.onFailure(t);
|
||||
UserThread.execute(() -> {
|
||||
timeoutTimer.stop();
|
||||
broadcastTimers.remove(tx.getHashAsString());
|
||||
callback.onFailure(t);
|
||||
});
|
||||
}
|
||||
});
|
||||
printTx("BSQ broadcast Tx", tx);
|
||||
|
@ -108,6 +108,7 @@ public class BuyerAsTakerSignAndPublishDepositTx extends TradeTask {
|
||||
}
|
||||
}
|
||||
});
|
||||
// We set the deposit tx in case we get the onFailure called.
|
||||
trade.setDepositTx(depositTx);
|
||||
} catch (Throwable t) {
|
||||
failed(t);
|
||||
|
@ -109,6 +109,7 @@ public class SellerAsTakerSignAndPublishDepositTx extends TradeTask {
|
||||
}
|
||||
}
|
||||
});
|
||||
// We set the deposit tx in case we get the onFailure called.
|
||||
trade.setDepositTx(depositTx);
|
||||
} catch (Throwable t) {
|
||||
final Contract contract = trade.getContract();
|
||||
|
Loading…
Reference in New Issue
Block a user