Commit Graph

761 Commits

Author SHA1 Message Date
chimp1984
c6868f1bed
Call p2PDataStorage.onBootstrapComplete() before
mailboxMessageService.onBootstrapped(); and onUpdatedDataReceived

mailboxMessageService depends on p2PDataStorage so we make sure the
p2PDataStorage is updated before we update the mailboxMessageService state.
2021-02-19 10:09:04 +01:00
chimp1984
49e9f72d6e
Merge onUpdatedDataReceived and onNoSeedNodeAvailable to onBootstrapped 2021-02-19 10:09:04 +01:00
chimp1984
44fcfb86bb
Call onNoSeedNodeAvailable on mailboxMessageService at onNoSeedNodeAvailable 2021-02-19 10:09:04 +01:00
chimp1984
d39cdaa33e
Fixes https://github.com/bisq-network/bisq/issues/5204
Remove SetupListener implementation from MailboxMessageService.
Remove requestDataManager
Add onNoSeedNodeAvailable method
Call onNoSeedNodeAvailable from P2PService
2021-02-19 10:09:03 +01:00
chimp1984
fcaad5580b
Use readableFileSize instead of division by 1024 for kb display in statistic logs 2021-02-18 11:40:10 -05:00
chimp1984
9041bf4938
onUpdatedDataReceived must be called in the correct order.
We cannot use a listener at RequestDataManager as the order
is not defined if doing so.
So we use P2PService as our controlling entity to call
further clients in the correct order.
2021-01-31 19:38:46 +01:00
Christoph Atteneder
60fc17be2c
Update data stores for v1.5.5 2021-01-25 14:18:21 +01:00
chimp1984
5d13fdcdbb
Return early 2021-01-14 20:42:36 -05:00
chimp1984
7ba5ab5a4e
Change prio for mailboxMessageList persitence 2021-01-13 20:48:52 -05:00
chimp1984
d434cb3022
Sort persisted mail box messages by age and limit total number.
Add size limit.
Add log for number of persisted mailbox msg per day
2021-01-12 22:59:44 -05:00
chimp1984
2fb3bba74d
Use MailboxMessage as param type in sendEncryptedMailboxMessage 2021-01-12 17:47:44 -05:00
chimp1984
3834785828
Bugfix: Add processing of SendersNodeAddressMessage to
onBundleOfEnvelopes method.

In case we received a SendersNodeAddressMessage
inside a BundleOfEnvelope we did not set the
peers address.
2021-01-12 17:40:40 -05:00
chimp1984
3e69edeb9e
Remove comment 2021-01-12 17:34:54 -05:00
chimp1984
a21d79ad63
Refactor: rename 2021-01-12 17:34:28 -05:00
chimp1984
364a7f524c
Add toString 2021-01-12 16:14:32 -05:00
chimp1984
2b05ed54fc
Let MailboxMessage extend ExpirablePayload:
For all MailboxMessage we want to be sure they have an expire date.
Add getTTL methods and TTL value.
We use 7 days for ChatMessages and 30 days for PrivateNotificationMessages.
All others use default 15 days.
We prefer to keep them explicit and not use a default method in
ExpirablePayload or MailboxMessage.
The value in PrefixedSealedAndSignedMessage will not be used as the
sender use the TTL of the payload and pass that to the MailboxStoragePayload
where we store it in the extraMap. That way we can use different TTL even the
payload message is encrypted and we would not be able to look it up.
2021-01-12 16:14:13 -05:00
chimp1984
46f60260dc
Remove outdated code
Remove outdated comment
Add checkNotNull for senderNodeAddress
2021-01-12 15:46:33 -05:00
chimp1984
4c003cded6
Clone reportedPeers to avoid ConcurrentModificationExceptions 2021-01-12 15:33:31 -05:00
chimp1984
5c429bb3a7
Add containsKey check 2021-01-12 14:48:45 -05:00
chimp1984
d353140e7a
Refactor: rename getMyDecryptedMessages method to make it more explicit
that its only used for MailboxMsg
2021-01-12 13:54:54 -05:00
chimp1984
575196c16d
Refactor handleDecryptedMessageWithPubKey to use MailboxMessage
instead of decryptedMessageWithPubKey.
Here we change a bit the behaviour as now we check also if the
TradeMessage is a MailboxMessage. As that method is only called
from MailboxMessageService domain we never get a non MailboxMessage
here anyway and it would have been a bug.

Remove removeMailboxMsg(DecryptedMessageWithPubKey decryptedMessageWithPubKey) as not used anymore
2021-01-12 13:53:20 -05:00
chimp1984
3875bd85d1
Add removeMailboxMsg with MailboxMessage as argument 2021-01-12 13:24:42 -05:00
chimp1984
337ea89ce6
Add program argument flag republishMailboxEntries
Only republish if that flag is set, not depending if its a seedNode
2021-01-12 12:42:50 -05:00
chimp1984
b4ab8a4a0d
Fix incorrect comparison at RemovedPayloadsService.readPersisted
Add comments
Cleanups
2021-01-12 10:59:11 -05:00
chimp1984
d39a697611
Fix wrong delay, increase timeout 2021-01-12 10:48:29 -05:00
chimp1984
a9802e60cd
Refactor: return early 2021-01-12 10:48:29 -05:00
chimp1984
8d866d5d06
Improve logs, rename methods, variables 2021-01-12 10:48:29 -05:00
chimp1984
e933bfd281
Add temp. ignore to a failing test.
By debugging I could not see why it fails, behaviour seems correct.
I guess its a mock setup issue. Will look into it to fix it soon...
2021-01-12 10:48:28 -05:00
chimp1984
8e0181e528
Add republishExistingProtectedMailboxStorageEntry method
Seed nodes republish the persisted mailbox messages after
startup in chunks of 50 items with a 2 minute delay.

Move check for hasSequenceNrIncreased in addProtectedStorageEntry
earlier so we return earlier. This is a very common case for return
if we receive outdated data (like republished mailbox data we have
already received).

Mark logs with ## for easier find/replace for dev testing...
2021-01-12 10:48:28 -05:00
chimp1984
a54813a015
Increase timout for BroadcastHandler to 120 sec 2021-01-12 10:48:28 -05:00
chimp1984
320e5f1aef
Refactor: Rename method 2021-01-12 10:48:28 -05:00
chimp1984
659fe15b8d
Add comment 2021-01-12 10:48:28 -05:00
chimp1984
35ef3b842f
Add support for TTL defined by payload message so we can use
different TTL for lower prio mailbox messages like AckMessages.

As we cannot add a field without breaking signatures we
need to use the extraMap in MailboxStoragePayload
2021-01-12 10:48:28 -05:00
chimp1984
7a2501ea1b
Set uid inside constructor 2021-01-12 10:48:28 -05:00
chimp1984
873b557ce8
Add logs 2021-01-12 10:48:28 -05:00
chimp1984
026858d8b1
Refactor: move duplicated method
capabilityRequiredAndCapabilityNotSupported to CapabilityUtils
2021-01-12 10:48:27 -05:00
chimp1984
a3b2aad3b0
Refactor: move class to new utils package 2021-01-12 10:48:27 -05:00
chimp1984
de131c83b5
Use MailboxItem value at mailboxItemsByUid instead of a list:
The uid is not perfect like a cryptographic hash but it can be
considered safe enough to not have collusion. The list got filled
with duplicates, so should have been a hashSet anyway.
We cannot use the hash as that is not available at the remove method.
We might refactor that in future to get rid of that problematic uid as
key but will require a but more refactoring in the client code as well,
as we do not pass around the outer envelope data but only the decrypted
data.

- Add protectedStorageEntry from persisted mailbox messages to
P2PDataStorage at startup. This ensures that we add those keys to excludedKeys
and that helps to reduce load for seed nodes at initial data response.

- Refactoring at removeFromMapAndDataStore:

- Add trace logs
- Add more comments
2021-01-12 10:48:27 -05:00
chimp1984
9edad02e8f
Use a hashset for listeners 2021-01-12 10:48:27 -05:00
chimp1984
41a92eae7f
Refactor: Rename class 2021-01-12 10:48:27 -05:00
chimp1984
5ba7d78a39
Add RemovedPayloadsStorageService
Adjust param
2021-01-12 10:48:27 -05:00
chimp1984
1886b4eb9d
Set addressPrefixHash to empty bytes.
We have added the capability in 1.4.0 and have
enforced 1.5.1 so no traders can use that old
version anymore so the capability check is not
needed anymore.
2021-01-12 10:48:27 -05:00
chimp1984
e69a3f646c
Refactor: rename method 2021-01-12 10:48:27 -05:00
chimp1984
75e547fda5
Refactor: move classes to persistence package 2021-01-12 10:48:27 -05:00
chimp1984
32f887478b
Persist map for removed mailbox messages (AddOncePayload more generally)
We add the date when we add the hash so that we can remove expired data.
2021-01-12 10:48:26 -05:00
chimp1984
6146362d71
Add onRemoved method to remove mailbox entries once a remove message arrives
Add republishMailBoxMessages method
2021-01-12 10:48:26 -05:00
chimp1984
bfbc657c22
Remove old code 2021-01-12 10:48:26 -05:00
chimp1984
5245c205cb
Add filter for isMine at getMyMailBoxMessages
Add TODOs
2021-01-12 10:48:26 -05:00
chimp1984
63a0117b4b
Remove nullable return value from decryptProtectedMailboxStorageEntry
Remove Objects::nonNull check
Split handleMailboxItem into 2 methods for persisting and
for processing my mailbox msg
2021-01-12 10:48:26 -05:00
chimp1984
79363e7fa8
Refactor: Rename 2021-01-12 10:48:26 -05:00