Commit Graph

9881 Commits

Author SHA1 Message Date
Julian Knutsen
89ad234c43
[TESTS] Use ClockFake in tests to control time
Reduces non-deterministic failures of the refreshTTL tests that resulted
from the uncontrollable System.currentTimeMillis().

Now, all tests have extremely fine control over the elapsed time between
calls which makes the current and future tests much better.
2019-11-12 15:58:36 -08:00
Julian Knutsen
10eb9c0d01
Use Clock in ProtectedStorageEntry
Switch from System.currentTimeMills() to
Clock.millis() so dependency injection can
be used for tests that need finer control of time.

This involves attaching a Clock to the resolver
so all fromProto methods have one available when they
reconstruct a message. This uses the Injector for the APP
and a default Clock.systemDefaultZone is used in the manual
instantiations.

Work was already done in #3037 to make this possible.

All tests still use the default system clock for now.
2019-11-12 15:58:01 -08:00
Julian Knutsen
42680037bd
[REFACTOR] Clean up ProtectedStorageEntry ctor
Deduplicate some code in the ProtectedStorageEntry constructors in
preparation for passing in a Clock parameter.
2019-11-12 15:55:34 -08:00
Julian Knutsen
de72d3954d
Use dependency injected Clock in P2PDataStore
Use the DI Clock object already available in P2PDataStore, instead
of calling System.currentTimeMillis() directly. These two functions
have the same behavior and switching over allows finer control
of time in the tests.
2019-11-12 15:55:34 -08:00
Julian Knutsen
e5f9261d97
Update behavior of P2PDataStorage::remove() & removeMailboxData() on duplicate sequence #s
Remove operations are now only processed if the sequence number
is greater than the last operation seen for a specific payload.

The only creator of new remove entrys is the P2PService layer that always increments
the sequence number. So, this is either left around from a time where
removes needed to work with non-incrementing sequence numbers or just
a longstanding bug.

With the completion of this patch, all operations now require increasing
sequence numbers so it should be easier to reason about the behavior in
future debugging.
2019-11-11 08:49:31 -08:00
Julian Knutsen
cbda653aba
Update behavior of P2PDataStorage::refreshTTL() on duplicates
Now returns false if the sequence number of the refresh matches
the last operation seen for the specified hash. This is a more expected
return value when no state change occurs.

The only callers are either P2PService users that always increment the
sequence number or the onMessage() handler which doesn't verify the return
so there will be no visible change other than the increased readability
of the code and deduplication of the code paths.
2019-11-11 08:49:31 -08:00
Julian Knutsen
c1ad6b408b
Update behavior of P2PDataStorage::addProtectedStorageEntry() on duplicates
Now returns false on duplicate sequence numbers. This matches more of
the expected behavior for an add() function when the element previously exists.

The only callers are either P2PService users that always increment the
sequence number or the onMessage() handler which doesn't verify the return
so there will be no visible change other than the increased readability
of the code and deduplication of the code paths.
2019-11-11 08:49:27 -08:00
Julian Knutsen
86c8c839d1
[PR COMMENTS] Clean up logging messages
Removed duplicate log messages that are handled inside the various helper methods
and print more verbose state useful for debugging.

Updated potentially misleading comments around hashing collisions
2019-11-11 08:37:38 -08:00
Julian Knutsen
66e3ece63e
[REFACTOR] P2PDataStorage::removeMailboxData()
Refactor for readability and add comments for future readers.
2019-11-11 08:36:47 -08:00
Julian Knutsen
a569852524
[REFACTOR] P2PDataStorage::remove()
Refactor for readability and add comments to help future readers.
2019-11-11 08:36:47 -08:00
Julian Knutsen
ae502709ee
[REFACTOR] P2PDataStorage::refreshTTL()
Refactor for readability and add comments for future readers.
2019-11-11 08:36:46 -08:00
Julian Knutsen
f2f6399cac
[REFACTOR] P2PDataStorage::addProtectedStorageEntry()
Refactor addProtectedStorageEntry for more readability and add comments
to help future readers.
2019-11-11 08:36:38 -08:00
Julian Knutsen
5512f34566
[REFACTOR] P2PDataStorage::addPersistableNetworkPayload()
Add comments and refactor the body in order to make it easier to
understand.
2019-11-11 08:23:22 -08:00
Julian Knutsen
de5ffd43e3
[BUGFIX] Don't try and remove() if addMailboxData() fails
Fix a bug where remove() was called in the addMailboxData()
failure path.

1. Sender's can't remove mailbox entries. Only
   the receiver can remove it so even if the previous add() failed and
   left partial state, the remove() can never succeed.

2. Even if the sender could remove, this path used remove() instead
   of removeMailboxData() so it wouldn't have succeed anyway.

This patch cleans up the failure path as well as adds a precondition
for the remove() function to ensure future callers don't use them for
ProtectedMailboxStorageEntrys.
2019-11-11 08:18:52 -08:00
Florian Reimair
1e20961a55
Add tests for P2PDataStorage in order to safely refactor (#3554)
* [TESTS] Add tests for P2PDataStorage in order to safely refactor

These tests create real versions of the supported Payload & Entry types and
run them through the 3 entry points (onMessage, Init, standard add()/remove()/refresh(),
to verify the expected return values, internal state changes, and
external signals (listeners, broadcasts).

The tests are involved and I am proposing future work to make many of the objects
more testable that will greatly reduce the work and tests cases needed.

This work identified a few unexpected scenarios and potential bugs that are addressed
in dependent pull requests.

Code coverage when running P2PDataStorageTest:

Before:
Line: 4%
Branch: 0%

After:
Line: 78%
Branch 76%

* [PR COMMENTS] Don't use the real Alert class

Instead, create a ProtectedStoragePayloadStub class which mocks out the required
protobuf Message for hashing. The hash is equal to the ownerPubKey so they are unique.

* [PR COMMENTS] Use Client API in comments

Change the use of "public api" to "Client API" to describe the set of
callers that use the pattern addProtectedStorageEntry(getProtectedStorageEntry())
as a contrast to the onMessage handler users or the GetData users.
2019-11-10 11:01:54 +01:00
Julian Knutsen
e0c04ffcac
Merge branch 'master' into add-tests 2019-11-07 20:54:24 -08:00
Christoph Atteneder
2b2e2c237d Release/v1.2.3 (#3577)
* Bump version number

* Revert to SNAPSHOT version
2019-11-07 16:00:45 +01:00
Christoph Atteneder
68b3a8c4d4 Revert "Update tor, netlayer, jtorctl" (#3567) 2019-11-07 10:37:12 +01:00
Christoph Atteneder
585ccd3088 Update data stores and bitcoinj checkpoints (#3570) 2019-11-07 10:36:32 +01:00
Christoph Atteneder
2fc260b476 Update translations (#3569) 2019-11-07 10:28:44 +01:00
sqrrm
61e51a0b7a Fix trade view peer info (#3549)
* Rename: PeerInfoIcon makersAccount -> peersAccount

* Fix peer info in trade view peerinfoicon popup, fix #3548
2019-11-06 18:55:09 +01:00
chimp1984
fee7850f32 Improve handling of failed trades and offers (#3566)
* Improve handling of failed trades and offers

- Check if deposit tx is null
- Check if trade fee tx is rejected
- Listen to reject tx errors
- Cleanup addressEntryList
- Prevent opening disputes with if deposit tx is null
- Add null checks
- Improve logs
- Cleanups

* Add move to failed trade button to popup

In case the deposit tx is null we show a popup telling the user to move
the trade to failed trades after a restart if the problem persist.

* Change log level
2019-11-06 18:53:45 +01:00
Julian Knutsen
48d6ac4955
[PR COMMENTS] Use Client API in comments
Change the use of "public api" to "Client API" to describe the set of
callers that use the pattern addProtectedStorageEntry(getProtectedStorageEntry())
as a contrast to the onMessage handler users or the GetData users.
2019-11-06 09:17:32 -08:00
Julian Knutsen
52e4656e74
Merge branch 'master' into add-tests 2019-11-06 09:12:18 -08:00
Christoph Atteneder
70abd272d4 Only show approval icon for accounts that are able to sign (#3552) 2019-11-06 14:32:38 +01:00
chimp1984
b976bec492 Limit max. nr. of PersistableNetworkPayload and ProtectedStorageEntries (#3562)
* Limit max. nr. of PersistableNetworkPayload and ProtectedStorageEntry to 10000

To avoid that seed nodes get overloaded with requests for too many
PersistableNetworkPayload and ProtectedStorageEntry data we limit nr. of
entries to max 10000.

* Add peers node address to logs

* Improve logs

- Add log of size to GetBlocksResponse.toProtoNetworkEnvelope method
- Log in kb

* Log connection UID if not peer address available

* Add cleanup code or invalid objects

We have an invalid Filter object in the live network (prob. some dev
made some mistake). This code helps so clean that up.

* Add log
2019-11-05 20:50:38 +01:00
Christoph Atteneder
5a9768363e Default view should be OfferBookChartView when an old view has been removed (#3561) 2019-11-05 18:33:01 +01:00
Julian Knutsen
6d983dec8d
[PR COMMENTS] Don't use the real Alert class
Instead, create a ProtectedStoragePayloadStub class which mocks out the required
protobuf Message for hashing. The hash is equal to the ownerPubKey so they are unique.
2019-11-05 08:08:28 -08:00
Christoph Atteneder
00183db573
Merge pull request #3407 from lbryio/list-lbry-asset
List LBRY Credits (LBC)
2019-11-05 09:16:40 +01:00
Julian Knutsen
80928663c0
[TESTS] Add tests for P2PDataStorage in order to safely refactor
These tests create real versions of the supported Payload & Entry types and
run them through the 3 entry points (onMessage, Init, standard add()/remove()/refresh(),
to verify the expected return values, internal state changes, and
external signals (listeners, broadcasts).

The tests are involved and I am proposing future work to make many of the objects
more testable that will greatly reduce the work and tests cases needed.

This work identified a few unexpected scenarios and potential bugs that are addressed
in dependent pull requests.

Code coverage when running P2PDataStorageTest:

Before:
Line: 4%
Branch: 0%

After:
Line: 78%
Branch 76%
2019-11-04 10:16:34 -08:00
Christoph Atteneder
ad9360636b
Merge pull request #3526 from freimair/tor_0.4.1.6
Update tor, netlayer, jtorctl
2019-11-04 16:35:46 +01:00
Christoph Atteneder
33c9dd133e
Merge pull request #3551 from ripcurlx/add-missing-capability
Add missing network capability for trade statistics hash update
2019-11-04 14:56:48 +01:00
Florian Reimair
415aa105fb
Merge pull request #3434 from lusarz/refactor-bisq-environment-5
Refactor BisqEnvironment - change type of ignoreLocalBtcNode to boolean
2019-11-04 13:37:25 +01:00
Christoph Atteneder
6d6a4d0b5c
Add missing network capability for trade statistics hash update 2019-11-04 11:35:19 +01:00
wiz
fe4059a722 Update seednode config to increase resource limits for v1.2 (#3545)
* Update seednode systemd service, move env vars to separate file

* Update seednode README
2019-11-04 10:25:18 +01:00
Christoph Atteneder
9a8615a61c
Merge pull request #3550 from bisq-network/release/v1.2.2
Release/v1.2.2
2019-11-04 10:16:20 +01:00
lukasz
fe32649956 Refactor BisqEnvironment - change type of ignoreLocalBtcNode to boolean 2019-11-03 14:18:49 +01:00
Florian Reimair
8a443584e8
Merge pull request #3513 from bisq-3510/master
Launch in Limbo with BisqException when last navigation no longer exists
2019-11-01 11:38:43 +01:00
Florian Reimair
15fce7cfbf
Merge pull request #3534 from yahiheb/user-agreement-fix
Remove duplicate word in user agreement
2019-11-01 11:37:25 +01:00
Florian Reimair
901cde0ad9
Merge pull request #3539 from devinbileck/fix-btc-valuation-popups
Fix BTC valuation popups
2019-11-01 11:36:35 +01:00
Florian Reimair
df45102db3
Merge pull request #3511 from devinbileck/remove-donate-link
Remove donation link
2019-11-01 11:25:35 +01:00
Florian Reimair
c1e7a0bb6c
Merge pull request #3432 from lusarz/refactor-bisq-environment-3
Refactor BisqEnvironment - create getListProperty
2019-11-01 11:17:33 +01:00
Florian Reimair
9d6630790e
Merge pull request #3433 from lusarz/refactor-bisq-environment-4
Refactor BisqEnvironment - use @Getter annotation for appDataDir
2019-11-01 11:06:34 +01:00
Florian Reimair
1999cfb99a
Merge pull request #3356 from stejbac/fix-proposal-table-hide
Fix proposal table hide when switching to another screen and back
2019-11-01 10:47:36 +01:00
Florian Reimair
d174535bc8
Merge pull request #3327 from christophsturm/fix-dust-check
Check for dust after subtracting fee, not before.
2019-11-01 10:35:19 +01:00
Florian Reimair
8ee2d53219
Merge pull request #3251 from stejbac/fix-invalid-comparators
Fix invalid comparators
2019-11-01 10:07:25 +01:00
Christoph Atteneder
581436ee64
Revert to SNAPSHOT version 2019-11-01 09:05:52 +01:00
Christoph Atteneder
04777c4f2b
Update translations 2019-11-01 09:03:16 +01:00
Christoph Atteneder
0c85c8c7a6
Bump version number 2019-11-01 09:03:05 +01:00
Devin Bileck
89edd67ddc
Fix BTC valuation popups
When hovering over the BTC balances, the popup was using the market
price based on the locale combined with the preferred currency as its
units. This lead to the situation where it could show a mismatch
between value and units.

Instead, use the market price based on the preferred currency.

Fixes #3515
2019-11-01 00:51:05 -07:00