Fixed pubkey retrieval

Broadcast subscriptions shouldn't be disabled every time a pubkey, message or broadcast comes along... (this might also fix other strange behaviour)
This commit is contained in:
Christian Basler 2017-05-19 19:49:35 +02:00
parent 239c6ec7f4
commit 869d2e0386
1 changed files with 6 additions and 2 deletions

View File

@ -104,7 +104,7 @@ class DefaultMessageListener implements NetworkHandler.MessageListener, Internal
} else {
address = ctx.getAddressRepository().findContact(pubkey.getRipe());
}
if (address != null) {
if (address != null && address.getPubkey() == null) {
updatePubkey(address, pubkey);
}
} catch (DecryptionFailedException ignore) {
@ -170,11 +170,15 @@ class DefaultMessageListener implements NetworkHandler.MessageListener, Internal
}
protected void receive(InventoryVector iv, Plaintext msg) {
BitmessageAddress contact = ctx.getAddressRepository().getAddress(msg.getFrom().getAddress());
if (contact != null && contact.getPubkey() == null) {
updatePubkey(contact, msg.getFrom().getPubkey());
}
msg.setInventoryVector(iv);
labeler.setLabels(msg);
ctx.getMessageRepository().save(msg);
listener.receive(msg);
updatePubkey(msg.getFrom(), msg.getFrom().getPubkey());
if (msg.getType() == Plaintext.Type.MSG && msg.getTo().has(Pubkey.Feature.DOES_ACK)) {
ObjectMessage ack = msg.getAckMessage();