use of bisq.network.p2p.BootstrapListener in project bisq-core by bisq-network.
the class DisputeManager method onAllServicesInitialized.
public void onAllServicesInitialized() {
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
tryApplyMessages();
}
});
walletsSetup.downloadPercentageProperty().addListener((observable, oldValue, newValue) -> {
if (walletsSetup.isDownloadComplete())
tryApplyMessages();
});
walletsSetup.numPeersProperty().addListener((observable, oldValue, newValue) -> {
if (walletsSetup.hasSufficientPeersForBroadcast())
tryApplyMessages();
});
tryApplyMessages();
cleanupDisputes();
}
use of bisq.network.p2p.BootstrapListener in project bisq-core by bisq-network.
the class ArbitratorManager method onAllServicesInitialized.
// /////////////////////////////////////////////////////////////////////////////////////////
// API
// /////////////////////////////////////////////////////////////////////////////////////////
public void onAllServicesInitialized() {
arbitratorService.addHashSetChangedListener(new HashMapChangedListener() {
@Override
public void onAdded(ProtectedStorageEntry data) {
if (data.getProtectedStoragePayload() instanceof Arbitrator)
updateArbitratorMap();
}
@Override
public void onRemoved(ProtectedStorageEntry data) {
if (data.getProtectedStoragePayload() instanceof Arbitrator) {
updateArbitratorMap();
final Arbitrator arbitrator = (Arbitrator) data.getProtectedStoragePayload();
user.removeAcceptedArbitrator(arbitrator);
user.removeAcceptedMediator(getMediator(arbitrator));
}
}
});
persistedAcceptedArbitrators = new ArrayList<>(user.getAcceptedArbitrators());
user.clearAcceptedArbitrators();
// TODO we mirror arbitrator data for mediator as long we have not impl. it in the UI
user.clearAcceptedMediators();
if (user.getRegisteredArbitrator() != null) {
P2PService p2PService = arbitratorService.getP2PService();
if (p2PService.isBootstrapped())
startRepublishArbitrator();
else
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
startRepublishArbitrator();
}
});
}
filterManager.filterProperty().addListener((observable, oldValue, newValue) -> updateArbitratorMap());
updateArbitratorMap();
}
use of bisq.network.p2p.BootstrapListener in project bisq-core by bisq-network.
the class AccountAgeWitnessService method onAllServicesInitialized.
// /////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
// /////////////////////////////////////////////////////////////////////////////////////////
public void onAllServicesInitialized() {
p2PService.getP2PDataStorage().addPersistableNetworkPayloadMapListener(payload -> {
if (payload instanceof AccountAgeWitness)
addToMap((AccountAgeWitness) payload);
});
// At startup the P2PDataStorage initializes earlier, otherwise we ge the listener called.
p2PService.getP2PDataStorage().getPersistableNetworkPayloadList().getMap().values().forEach(e -> {
if (e instanceof AccountAgeWitness)
addToMap((AccountAgeWitness) e);
});
if (p2PService.isBootstrapped()) {
republishAllFiatAccounts();
} else {
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
republishAllFiatAccounts();
}
});
}
}
use of bisq.network.p2p.BootstrapListener in project bisq-desktop by bisq-network.
the class MainViewModel method setupDevDummyPaymentAccounts.
private void setupDevDummyPaymentAccounts() {
if (user.getPaymentAccounts() != null && user.getPaymentAccounts().isEmpty()) {
PerfectMoneyAccount perfectMoneyAccount = new PerfectMoneyAccount();
perfectMoneyAccount.init();
perfectMoneyAccount.setAccountNr("dummy_" + new Random().nextInt(100));
// Don't translate only for dev
perfectMoneyAccount.setAccountName("PerfectMoney dummy");
perfectMoneyAccount.setSelectedTradeCurrency(GlobalSettings.getDefaultTradeCurrency());
user.addPaymentAccount(perfectMoneyAccount);
if (p2PService.isBootstrapped()) {
accountAgeWitnessService.publishMyAccountAgeWitness(perfectMoneyAccount.getPaymentAccountPayload());
} else {
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
accountAgeWitnessService.publishMyAccountAgeWitness(perfectMoneyAccount.getPaymentAccountPayload());
}
});
}
CryptoCurrencyAccount cryptoCurrencyAccount = new CryptoCurrencyAccount();
cryptoCurrencyAccount.init();
// Don't translate only for dev
cryptoCurrencyAccount.setAccountName("ETH dummy");
cryptoCurrencyAccount.setAddress("0x" + new Random().nextInt(1000000));
cryptoCurrencyAccount.setSingleTradeCurrency(CurrencyUtil.getCryptoCurrency("ETH").get());
user.addPaymentAccount(cryptoCurrencyAccount);
}
}
use of bisq.network.p2p.BootstrapListener in project bisq-core by bisq-network.
the class OpenOfferManager method onAllServicesInitialized.
public void onAllServicesInitialized() {
p2PService.addDecryptedDirectMessageListener(this);
if (p2PService.isBootstrapped()) {
onBootstrapComplete();
} else {
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
onBootstrapComplete();
}
});
}
cleanUpAddressEntries();
}
Aggregations