Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jun 24, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/src/main/java/bisq/core/arbitration/DisputeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;


///////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -177,6 +178,7 @@ public void readPersisted() {
}

public void onAllServicesInitialized() {
servicesInitialized = true;
p2PService.addP2PServiceListener(new BootstrapListener() {
@Override
public void onUpdatedDataReceived() {
Expand Down Expand Up @@ -266,6 +268,13 @@ private boolean isReadyForTxBroadcast() {
}

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if it would make more sense to put this check in tryApplyMessages? Since it appears to be the only caller of applyMessages and has an additional check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved to the readiness check, looks much more reasonable, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ack again if it looks good.

}

decryptedDirectMessageWithPubKeys.forEach(decryptedMessageWithPubKey -> {
NetworkEnvelope networkEnvelope = decryptedMessageWithPubKey.getNetworkEnvelope();
if (networkEnvelope instanceof DisputeMessage) {
Expand Down