mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Fix missing handling of mailbox msg
This commit is contained in:
parent
b4917c1822
commit
546737a728
@ -52,6 +52,8 @@ import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Holds all data which are relevant to the trade, but not those which are only needed in the trade process as shared data between tasks. Those data are
|
||||
@ -170,6 +172,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
transient private StringProperty errorMessageProperty;
|
||||
transient private ObjectProperty<Coin> tradeAmountProperty;
|
||||
transient private ObjectProperty<Fiat> tradeVolumeProperty;
|
||||
transient private Set<DecryptedMsgWithPubKey> mailboxMessageSet = new HashSet<>();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -210,6 +213,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
initStateProperties();
|
||||
initAmountProperty();
|
||||
errorMessageProperty = new SimpleStringProperty(errorMessage);
|
||||
mailboxMessageSet = new HashSet<>();
|
||||
} catch (Throwable t) {
|
||||
log.warn("Cannot be deserialized." + t.getMessage());
|
||||
}
|
||||
@ -242,10 +246,11 @@ public abstract class Trade implements Tradable, Model {
|
||||
|
||||
createProtocol();
|
||||
|
||||
log.trace("decryptedMsgWithPubKey = " + decryptedMsgWithPubKey);
|
||||
if (decryptedMsgWithPubKey != null)
|
||||
log.trace("init: decryptedMsgWithPubKey = " + decryptedMsgWithPubKey);
|
||||
if (decryptedMsgWithPubKey != null && !mailboxMessageSet.contains(decryptedMsgWithPubKey)) {
|
||||
mailboxMessageSet.add(decryptedMsgWithPubKey);
|
||||
tradeProtocol.applyMailboxMessage(decryptedMsgWithPubKey, this);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void initStateProperties() {
|
||||
@ -288,8 +293,13 @@ public abstract class Trade implements Tradable, Model {
|
||||
}
|
||||
|
||||
public void setMailboxMessage(DecryptedMsgWithPubKey decryptedMsgWithPubKey) {
|
||||
log.trace("setMailboxMessage " + decryptedMsgWithPubKey);
|
||||
log.trace("setMailboxMessage decryptedMsgWithPubKey=" + decryptedMsgWithPubKey);
|
||||
this.decryptedMsgWithPubKey = decryptedMsgWithPubKey;
|
||||
|
||||
if (tradeProtocol != null && decryptedMsgWithPubKey != null && !mailboxMessageSet.contains(decryptedMsgWithPubKey)) {
|
||||
mailboxMessageSet.add(decryptedMsgWithPubKey);
|
||||
tradeProtocol.applyMailboxMessage(decryptedMsgWithPubKey, this);
|
||||
}
|
||||
}
|
||||
|
||||
public DecryptedMsgWithPubKey getMailboxMessage() {
|
||||
@ -309,7 +319,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
this.state = state;
|
||||
stateProperty.set(state);
|
||||
persist();
|
||||
persist();
|
||||
}
|
||||
|
||||
public void setDisputeState(DisputeState disputeState) {
|
||||
|
@ -158,6 +158,7 @@ public class TradeManager {
|
||||
}
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
Log.traceCall();
|
||||
if (p2PService.isBootstrapped())
|
||||
initPendingTrades();
|
||||
else
|
||||
|
@ -27,7 +27,7 @@
|
||||
<logger name="io.bitsquare.p2p.peers.peerexchange" level="WARN"/>
|
||||
|
||||
<logger name="io.bitsquare.p2p.network" level="WARN"/>
|
||||
<logger name="io.bitsquare.p2p.P2PService" level="WARN"/>
|
||||
<!-- <logger name="io.bitsquare.p2p.P2PService" level="WARN"/>-->
|
||||
|
||||
|
||||
<!-- <logger name="io.bitsquare.p2p.peers.PeerGroup" level="TRACE"/>
|
||||
|
@ -223,6 +223,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
}
|
||||
|
||||
public void onAllServicesInitialized() {
|
||||
Log.traceCall();
|
||||
if (networkNode.getNodeAddress() != null) {
|
||||
p2PDataStorage.getMap().values().stream().forEach(protectedStorageEntry -> {
|
||||
if (protectedStorageEntry instanceof ProtectedMailboxStorageEntry)
|
||||
@ -529,6 +530,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void processProtectedMailboxStorageEntry(ProtectedMailboxStorageEntry protectedMailboxStorageEntry) {
|
||||
Log.traceCall();
|
||||
final NodeAddress nodeAddress = networkNode.getNodeAddress();
|
||||
// Seed nodes don't receive mailbox messages
|
||||
if (optionalEncryptionService.isPresent() && nodeAddress != null && !seedNodesRepository.isSeedNode(nodeAddress)) {
|
||||
|
Loading…
Reference in New Issue
Block a user