Wait for initialized wallet before processing dispute msgs, fix #2914

This commit is contained in:
sqrrm 2019-06-23 17:32:46 +02:00
parent d53c3b387c
commit cf5c03f43d
No known key found for this signature in database
GPG key ID: 45235F9EF87089EC

View file

@ -120,6 +120,7 @@ public class DisputeManager implements PersistedDataHost {
private final Map<String, Subscription> disputeIsClosedSubscriptionsMap = new HashMap<>();
@Getter
private final IntegerProperty numOpenDisputes = new SimpleIntegerProperty();
private boolean servicesInitialized;
///////////////////////////////////////////////////////////////////////////////////////////
@ -177,6 +178,7 @@ public class DisputeManager implements PersistedDataHost {
}
public void onAllServicesInitialized() {
servicesInitialized = true;
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
@ -266,6 +268,13 @@ public class DisputeManager implements PersistedDataHost {
}
private void applyMessages() {
// Some messages can't be handled until all the services are properly initialized.
// In particular it's not possible to complete the signing of a dispute payout
// by an encrypted wallet until after it's been decrypted.
if (!servicesInitialized) {
return;
}
decryptedDirectMessageWithPubKeys.forEach(decryptedMessageWithPubKey -> {
NetworkEnvelope networkEnvelope = decryptedMessageWithPubKey.getNetworkEnvelope();
if (networkEnvelope instanceof DisputeMessage) {