Commit Graph

3653 Commits

Author SHA1 Message Date
Christoph Atteneder
543a11e1ec
Merge pull request #3777 from beingindot/revolut-phonenumber-validation
Revolut account should accept only phone number
2019-12-18 08:33:03 +01:00
beingindot
da683e8b49
Revolut account should accept only phone number
For issue #3728
	Till now we used to accept email or phone number
	Now we are accepting only phone number in input though
	for display we will provide backward compatibility.

	Added list of countries accepted from official revolut website
	https://www.revolut.com/en-US/help/getting-started/verifying-identity/what-countries-are-supported

	Based on the country selected, we will validate the given
	phone number input.
2019-12-17 21:02:39 +05:30
wiz
e41df654b0
Remove betanet and testnet BSQ block explorers 2019-12-17 19:41:32 +09:00
Christoph Atteneder
6f1dbf1c09
Add shortcut list (#3695)
* Remove short cut for legacy arbitrator registration

* Change shortcut for reRepublishAllGovernanceData

* Use isAltOrCtrlPressed for removeFailedTrade

* Remove showStatisticsPopup

This was useful for legacy arbitrators as they received the trade fee

* Cleanup

- Remove setColumnSpan for titledGroupBg
- Fix row length

* Add list of shortcuts

* Update comment

* Change "click" to "press"
2019-12-17 11:22:34 +01:00
Christoph Atteneder
20b56c7bde
Merge pull request #3773 from stejbac/add-tx-map-to-daostate
Add transient tx map to DaoState to speed up getTx queries
2019-12-16 15:21:03 +01:00
wiz
78a72a2cc8
Add user preference combobox for BSQ block explorer with random default 2019-12-16 00:19:13 +09:00
Christoph Atteneder
26291eb0ee
Not allow bitcoinj to auto connect to localhost when localhost was not detected by client
This fixes the problem if the local bitcoin core node is not detected by our client,
but bitcoinj is able to connect to it because of the auto connect to localhost behavior.
In that case the minimum required nodes to broadcast a transaction will be 4 (provided nodes settings),
but bitcoinj will only connect to one node. The requirement of 4 nodes will be never fulfilled and
the transaction never broadcasted.
2019-12-12 17:27:15 +01:00
Steven Barclay
b22e4ad113
Encapsulate mutable Block tx list and DaoState tx cache
Avoid mutating the Block tx list or the DaoState tx cache/index via a
Lombok getter. Instead wrap each in an unmodifiable[List|Map] & provide
specific mutator methods for use by DaoStateService to add newly parsed
transactions or load a DAO snapshot.

Also rename txMap to txCache, replace remaining use of getTxStream() in
the JSON file exporter with getUnorderedTxStream() (as this is safe) and
swap the arguments of the txCache initialisation merge function, for
exact consistency with the pre-caching behaviour.

Finally, add a missing assertDaoStateChange() and remove a potentially
harmful assertion from DaoStateService.onNewTxForLastBlock.

This is based on a suggested patch by @chimp1984 in the PR #3773 review.
2019-12-12 03:08:56 +00:00
Steven Barclay
4277cf83ca
Use unordered Tx stream from daoState.txMap wherever possible
Add getUnorderedTxStream() method to DaoStateService to stream directly
from the txMap cache/index wherever it is obviously safe to do so,
instead of iterating through the entire block list via getTxStream().

Also make getTxs() return a view of the txMap values in place of a copy.

This should improve efficiency slightly.
2019-12-11 12:44:34 +00:00
Steven Barclay
0fa21b5f1a
Add transient tx map to DaoState to speed up getTx queries
Build a HashMap of all BSQ transactions found, when loading the DaoState
from disc, and store it in a transient field which is always kept in
sync with the associated list of blocks. (The latter is only modified in
a couple of places in DaoStateService, making this straightforward.)

This is to speed up daoStateService.getTx(id), which is called from many
places and appears to be a significant bottleneck. In particular, the
initial load of the results in VoteResultView.doFillCycleList was very
slow (taking nearly a minute on a Core i3 machine) and likely to suffer
a quadratic slowdown (#cycles * #tx's) over time.
2019-12-11 11:26:08 +00:00
Christoph Atteneder
3fe84975ad
Merge pull request #3747 from julianknutsen/clean-up-pse-objs
(6/6) Clean up technical debt in P2PDataStorage and ProtectedStorageEntry objects
2019-12-09 20:34:26 +01:00
Florian Reimair
30f96643b2
Merge pull request #3771 from ripcurlx/fix-dark-mode-switch-plus-cleanup
Fixes dark mode switch after restart
2019-12-09 17:43:39 +01:00
Christoph Atteneder
b2c006d4a3
Update css theme property when read from data store 2019-12-09 15:44:52 +01:00
Christoph Atteneder
f398117147
Remove unnecessary indirection for setting custom withdrawal fees 2019-12-09 15:35:15 +01:00
Christoph Atteneder
af46a7f697
Merge pull request #3760 from wiz/ef5qnzx6znifo3df-transfer
Transfer seednode ef5qnzx6znifo3df.onion to @wiz and @emzy
2019-12-09 12:21:45 +01:00
sqrrm
b2ea064b93
Merge pull request #3745 from dmos62/master
Rename "Spread" tab to a more general "Details"
2019-12-07 14:44:01 +01:00
chimp1984
734b1f08f7
Change "click" to "press" 2019-12-06 23:35:05 -05:00
wiz
a34610ed98
Transfer seednode ef5qnzx6znifo3df.onion to @wiz and @emzy 2019-12-07 02:19:13 +09:00
sqrrm
2e196ec722
Merge pull request #3743 from ripcurlx/fix-refundagents-supported-language-warning
Display warning based on supported languages by mediators and refund agents
2019-12-06 15:34:32 +01:00
Christoph Atteneder
44b4f429da
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.2.4
# Conflicts:
#	core/src/main/resources/i18n/displayStrings_zh-hant.properties
2019-12-06 11:30:10 +01:00
Dominykas Mostauskis
7e5422f0ef
Rename "Spread" tab to a more general "Details"
Because spread is one of many columns in the table, calling the whole tab spread is not general enough.
2019-12-05 13:27:35 +01:00
Christoph Atteneder
acd4350762
Update data stores, translations and bitcoinj checkpoints (#3748)
* Update bitcoinj checkpoint file

* Update translations

* Update data stores
2019-12-04 22:26:42 +01:00
Christoph Atteneder
87670c1e5e
Display warning based on supported languages by mediators and refund agents 2019-12-04 12:32:25 +01:00
Julian Knutsen
bfdb8f5715
Make isDataOwner a private policy decision in BroadcastHandler
isDataOwner is used when deciding how many peer nodes should receive
a BroadcastMessage. If the BroadcastMessage originated
on the local node it is sent to ALL peer nodes with a small delay.

If the node is only relaying the message (it originated on a different
node) it is sent to MAX(peers.size(), 7) peers with a delay that is
twice as long.

All the information needed to determine whether or not the
BroadcastMessage originated on the local node is available at the final
broadcast site and there is no reason to have callers pass it in.

In the event that the sender address is not known during broadcast (which
is only a remote possibility due to how early the local node address
is set during startup) we can default to relay mode.

This first patch just removes the deep parameters. The next will remove
everything else. There is one real change in LiteNodeNetworkService.java
where it was using the local node when it should have been using the
peer node. This was updated to the correct behavior.
2019-12-03 12:33:29 -08:00
Julian Knutsen
9f69134568
[REFACTOR] Clean up ClientAPI for refreshTTL
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:07 -08:00
Julian Knutsen
77413c9671
[REFACTOR] Clean up ClientAPI for remove
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:06 -08:00
Julian Knutsen
0e6b1a2044
[REFACTOR] Clean up ClientAPI for addProtectedStorageEntry
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:06 -08:00
Julian Knutsen
ecae31eddb
[RENAME] LazyProcessedPayload to ProcessOncePersistableNetworkPayload
Name is left over from previous implementation. Change it to be more
relevant to the current code and update comments to indicate the
current usage.
2019-12-03 12:20:41 -08:00
wiz
f0cbddc545
Add Chinese Traditional file to update_translations.sh script 2019-12-03 12:01:02 +01:00
wiz
2d188000c2
Add zh-hant translations (Chinese Traditional) 2019-12-03 12:00:54 +01:00
wiz
ba492b88e6
Adjust update_translations.sh language tags for script/regional variants 2019-12-03 11:50:55 +01:00
wiz
0bf75aeb42
Fix language tags so script and regional variants work correctly 2019-12-03 11:50:45 +01:00
wiz
4dab4fc25e
Add Chinese Traditional file to update_translations.sh script 2019-12-03 19:49:47 +09:00
wiz
62fde1e7ab
Add zh-hant translations (Chinese Traditional) 2019-12-03 19:49:44 +09:00
Christoph Atteneder
5a0db50d3c
Update strings to reflect bisq is exchange network (#3681)
* Update strings to reflect bisq is exchange network

Motivated by changes done to the website, as described in
https://github.com/bisq-network/bisq-website/pull/280

* Use lowercase 'bitcoin'

Based on feedback mentioned in this comment:
https://github.com/bisq-network/bisq-website/pull/280#discussion_r351491215
2019-12-03 11:43:47 +01:00
Christoph Atteneder
d8e19c4e8c
Use correct language tags for script and regional language variants (#3716)
* Fix language tags so script and regional variants work correctly

* Adjust update_translations.sh language tags for script/regional variants

ACKs for top commit:
  @ripcurlx:
    ACK 089232716d
2019-12-03 11:37:32 +01:00
chimp1984
c2e8806d16
Add handling of mediationResultState to isFundsLockedIn
Fixes https://github.com/bisq-network/bisq/issues/3721
(part of the problem was that the trade ended up in failed trade)

Refactor method and add comments.
We did not handle the case of a mediated payout. isPayoutPublished() is
only reflecting non-disputed trade payouts.
2019-12-02 11:58:12 +01:00
chimp1984
04c02589aa
Refactoring: Replace isGreaterThan(Coin.ZERO) with isPositive() 2019-12-02 11:57:25 +01:00
chimp1984
fdc582a60e
Do not add an output if value is 0 BTC
Fixes https://github.com/bisq-network/bisq/issues/3721 and
https://github.com/bisq-network/bisq/issues/3722

There are still more issues as such a payout tx will cause that the
trade ends up in failed trades. This commit only fixes the invalid
tx issue.
2019-12-02 11:57:12 +01:00
Christoph Atteneder
51982fdcd6
Merge pull request #3726 from chimp1984/do-not-move-mediated-trades-to-failed-trades
Add handling of mediationResultState to isFundsLockedIn
2019-12-02 11:12:21 +01:00
chimp1984
9ac64e5e3e
Add handling of mediationResultState to isFundsLockedIn
Fixes https://github.com/bisq-network/bisq/issues/3721
(part of the problem was that the trade ended up in failed trade)

Refactor method and add comments.
We did not handle the case of a mediated payout. isPayoutPublished() is
only reflecting non-disputed trade payouts.
2019-12-01 19:23:45 -05:00
chimp1984
c126f0ec09
Refactoring: Replace isGreaterThan(Coin.ZERO) with isPositive() 2019-12-01 18:34:58 -05:00
chimp1984
bfa123bf6c
Do not add an output if value is 0 BTC
Fixes https://github.com/bisq-network/bisq/issues/3721 and
https://github.com/bisq-network/bisq/issues/3722

There are still more issues as such a payout tx will cause that the
trade ends up in failed trades. This commit only fixes the invalid
tx issue.
2019-12-01 18:34:13 -05:00
wiz
089232716d
Adjust update_translations.sh language tags for script/regional variants 2019-11-29 11:34:22 +09:00
wiz
9d25041746
Fix language tags so script and regional variants work correctly 2019-11-29 11:29:21 +09:00
Devin Bileck
e443b8fade
Use lowercase 'bitcoin'
Based on feedback mentioned in this comment:
https://github.com/bisq-network/bisq-website/pull/280#discussion_r351491215
2019-11-27 22:36:53 -08:00
Steve Jain
548a217751
Replace arbitration link in tac
With link to v1.2 dispute resolution documentation.
2019-11-27 10:30:39 +01:00
chimp1984
88cbecd8ed
Use 2of2 multisig deposit tx version for manual payout
With v1.2 we use 2of2 multisig for deposit tx. This commit changes the
manual payout window to reflect that.

- Remove unused code from legacy arbitration
- Fix comments
2019-11-27 10:30:25 +01:00
Christoph Atteneder
e00ae654d4
Merge pull request #3696 from m52go/fix-ua-arblink
Replace arbitration link in tac
2019-11-27 09:11:15 +01:00
Christoph Atteneder
c131a890f2
Update translations 2019-11-27 08:54:35 +01:00
Christoph Atteneder
cf3a13e08a
Update bitcoinj checkpoints file 2019-11-27 08:51:49 +01:00
Steve Jain
4c27da7644
Replace arbitration link in tac
With link to v1.2 dispute resolution documentation.
2019-11-26 23:33:25 -05:00
chimp1984
a67b960df9
Update comment 2019-11-26 15:47:21 -05:00
chimp1984
477f9de23a
Use 2of2 multisig deposit tx version for manual payout
With v1.2 we use 2of2 multisig for deposit tx. This commit changes the
manual payout window to reflect that.

- Remove unused code from legacy arbitration
- Fix comments
2019-11-26 13:33:30 -05:00
chimp1984
91b76d4231
Add list of shortcuts 2019-11-26 12:51:57 -05:00
Christoph Atteneder
06f0d6b191
Reputation BSQ added to BSQ Wallet screen (#3366)
* BSQ Merit now displayed - fixes issue #3352

* Broke merit text setting to 2 lines.

* Fix formatting
2019-11-26 15:50:35 +01:00
Christoph Atteneder
a7b9cfdec7
Merge pull request #3676 from chimp1984/dont-show-rejected-bonded-roles
Only show accepted bonded roles in bond view.
2019-11-26 14:43:54 +01:00
Christoph Atteneder
e0a92ca9fe
Prevent taking of offers with unequal bank account types (excl. SEPA) (#3673)
* Use strict stubbing for ReceiptValidatorTest to avoid confusion

Remove redundant stubs from the MoneyGram and Western Union tests and
ensure that all such stubs result in failure. In particular, the 'offer'
mock is never accessed directly by ReceiptValidator.

* Prevent taking of offers with unequal bank account types

Use stricter criteria when deciding which of the taker's accounts (if
any) are valid for a given offer. Specifically, prevent National Bank
accounts from being used to take Same / Specific Bank(s) offers, so the
three payment method types can never being mixed.

This prevents an error on the trading peer when the trade starts, due to
enforcement of equal maker & taker payment method IDs (except for SEPA)
in the Contract payload constructor.

This partially addresses #3602, where the erroneous peer response causes
the taker to be presented with a confusing timeout.
2019-11-26 14:39:18 +01:00
Christoph Atteneder
62aea83308
Cleanup fmxlview and javax imports (#3661)
* Remove @FxmlView from abstract view classes

* Use generic javax imports for DI

* Additional cleanup of redundant DI annotations
2019-11-26 14:36:01 +01:00
Christoph Atteneder
66b2306ed9
P2PDataStorage and FileManager improvements (#3690)
* [PR COMMENTS] Make maxSequenceNumberBeforePurge final

Instead of using a subclass that overwrites a value, utilize Guice
to inject the real value of 10000 in the app and let the tests overwrite
it with their own.

* [TESTS] Clean up 'Analyze Code' warnings

Remove unused imports and clean up some access modifiers now that
the final test structure is complete

* [REFACTOR] HashMapListener::onAdded/onRemoved

Previously, this interface was called each time an item was changed. This
required listeners to understand performance implications of multiple
adds or removes in a short time span.

Instead, give each listener the ability to process a list of added or
removed entrys which can help them avoid performance issues.

This patch is just a refactor. Each listener is called once for each
ProtectedStorageEntry. Future patches will change this.

* [REFACTOR] removeFromMapAndDataStore can operate on Collections

Minor performance overhead for constructing MapEntry and Collections
of one element, but keeps the code cleaner and all removes can still
use the same logic to remove from map, delete from data store, signal
listeners, etc.

The MapEntry type is used instead of Pair since it will require less
operations when this is eventually used in the removeExpiredEntries path.

* Change removeFromMapAndDataStore to signal listeners at the end in a batch

All current users still call this one-at-a-time. But, it gives the ability
for the expire code path to remove in a batch.

* Update removeExpiredEntries to remove all items in a batch

This will cause HashMapChangedListeners to receive just one onRemoved()
call for the expire work instead of multiple onRemoved() calls for each
item.

This required a bit of updating for the remove validation in tests so
that it correctly compares onRemoved with multiple items.

* ProposalService::onProtectedDataRemoved signals listeners once on batch removes

#3143 identified an issue that tempProposals listeners were being
signaled once for each item that was removed during the P2PDataStore
operation that expired old TempProposal objects. Some of the listeners
are very expensive (ProposalListPresentation::updateLists()) which results
in large UI performance issues.

Now that the infrastructure is in place to receive updates from the
P2PDataStore in a batch, the ProposalService can apply all of the removes
received from the P2PDataStore at once. This results in only 1 onChanged()
callback for each listener.

The end result is that updateLists() is only called once and the performance
problems are reduced.

This removes the need for #3148 and those interfaces will be removed in
the next patch.

* Remove HashmapChangedListener::onBatch operations

Now that the only user of this interface has been removed, go ahead
and delete it. This is a partial revert of
f5d75c4f60 that includes the code that was
added into ProposalService that subscribed to the P2PDataStore.

* [TESTS] Regression test for #3629

Write a test that shows the incorrect behavior for #3629, the hashmap
is rebuilt from disk using the 20-byte key instead of the 32-byte key.

* [BUGFIX] Reconstruct HashMap using 32-byte key

Addresses the first half of #3629 by ensuring that the reconstructed
HashMap always has the 32-byte key for each payload.

It turns out, the TempProposalStore persists the ProtectedStorageEntrys
on-disk as a List and doesn't persist the key at all. Then, on
reconstruction, it creates the 20-byte key for its internal map.

The fix is to update the TempProposalStore to use the 32-byte key instead.
This means that all writes, reads, and reconstrution of the TempProposalStore
uses the 32-byte key which matches perfectly with the in-memory map
of the P2PDataStorage that expects 32-byte keys.

Important to note that until all seednodes receive this update, nodes
will continue to have both the 20-byte and 32-byte keys in their HashMap.

* [BUGFIX] Use 32-byte key in requestData path

Addresses the second half of #3629 by using the HashMap, not the
protectedDataStore to generate the known keys in the requestData path.

This won't have any bandwidth reduction until all seednodes have the
update and only have the 32-byte key in their HashMap.

fixes #3629

* [DEAD CODE] Remove getProtectedDataStoreMap

The only user has been migrated to getMap(). Delete it so future
development doesn't have the same 20-byte vs 32-byte key issue.

* [TESTS] Allow tests to validate SequenceNumberMap write separately

In order to implement remove-before-add behavior, we need a way to
verify that the SequenceNumberMap was the only item updated.

* Implement remove-before-add message sequence behavior

It is possible to receive a RemoveData or RemoveMailboxData message
before the relevant AddData, but the current code does not handle
it.

This results in internal state updates and signal handler's being called
when an Add is received with a lower sequence number than a previously
seen Remove.

Minor test validation changes to allow tests to specify that only the
SequenceNumberMap should be written during an operation.

* [TESTS] Allow remove() verification to be more flexible

Now that we have introduced remove-before-add, we need a way
to validate that the SequenceNumberMap was written, but nothing
else. Add this feature to the validation path.

* Broadcast remove-before-add messages to P2P network

In order to aid in propagation of remove() messages, broadcast them
in the event the remove is seen before the add.

* [TESTS] Clean up remove verification helpers

Now that there are cases where the SequenceNumberMap and Broadcast
are called, but no other internal state is updated, the existing helper
functions conflate too many decisions. Remove them in favor of explicitly
defining each state change expected.

* [BUGFIX] Fix duplicate sequence number use case (startup)

Fix a bug introduced in d484617385 that
did not properly handle a valid use case for duplicate sequence numbers.

For in-memory-only ProtectedStoragePayloads, the client nodes need a way
to reconstruct the Payloads after startup from peer and seed nodes. This
involves sending a ProtectedStorageEntry with a sequence number that
is equal to the last one the client had already seen.

This patch adds tests to confirm the bug and fix as well as the changes
necessary to allow adding of Payloads that were previously seen, but
removed during a restart.

* Clean up AtomicBoolean usage in FileManager

Although the code was correct, it was hard to understand the relationship
between the to-be-written object and the savePending flag.

Trade two dependent atomics for one and comment the code to make it more
clear for the next reader.

* [DEADCODE] Clean up FileManager.java

* [BUGFIX] Shorter delay values not taking precedence

Fix a bug in the FileManager where a saveLater called with a low delay
won't execute until the delay specified by a previous saveLater call.

The trade off here is the execution of a task that returns early vs.
losing the requested delay.

* [REFACTOR] Inline saveNowInternal

Only one caller after deadcode removal.
2019-11-26 14:34:32 +01:00
Florian Reimair
d12843a74c
Merge pull request #3682 from ripcurlx/improve-account-signing
Improve account signing security
2019-11-26 12:50:12 +01:00
Devin Bileck
70296a94af
Update strings to reflect bisq is exchange network
Motivated by changes done to the website, as described in
https://github.com/bisq-network/bisq-website/pull/280
2019-11-25 00:28:50 -08:00
chimp1984
ff10f7cf3f
Only show accepted bonded roles in bond view.
Fixes #3271

Replaces https://github.com/bisq-network/bisq/pull/3320
2019-11-24 13:10:10 -05:00
Justin Carter
fe00f4aac9
Use correct monetary format in BsqFormatter
Also remove logic regarding base currency. Only BTC is currently
supported so there is no need to keep the logic around.
2019-11-24 07:59:02 +01:00
Steven Barclay
fc7d31ef83
Prevent taking of offers with unequal bank account types
Use stricter criteria when deciding which of the taker's accounts (if
any) are valid for a given offer. Specifically, prevent National Bank
accounts from being used to take Same / Specific Bank(s) offers, so the
three payment method types can never being mixed.

This prevents an error on the trading peer when the trade starts, due to
enforcement of equal maker & taker payment method IDs (except for SEPA)
in the Contract payload constructor.

This partially addresses #3602, where the erroneous peer response causes
the taker to be presented with a confusing timeout.
2019-11-24 05:08:42 +00:00
Steven Barclay
e5afb17269
Use strict stubbing for ReceiptValidatorTest to avoid confusion
Remove redundant stubs from the MoneyGram and Western Union tests and
ensure that all such stubs result in failure. In particular, the 'offer'
mock is never accessed directly by ReceiptValidator.
2019-11-24 02:22:11 +00:00
Justin Carter
d4e7f86ff6
Use generic javax imports for DI 2019-11-22 14:50:21 +01:00
Christoph Atteneder
0ac6bf1307
Only allow seller side to sign accounts
This prevents a scammer to use publicly known account details
(without being in control of the account) as a seller to get
signed by a buyer. The money received in the seller account might
not be detected by the legitimate owner and/or the money not sent back.
30 days later the scammer could use this signed account as seed to peer sign other stolen accounts.
2019-11-22 11:32:43 +01:00
Christoph Atteneder
46ce873b01
Add additional trade amount limit for trades that qualify for account signing
Should make it easier to detect by a stolen bank account owner as buyer that an outgoing transactions is taking place.
2019-11-22 11:26:46 +01:00
Julian Knutsen
e212240b88
[BUGFIX] Reconstruct HashMap using 32-byte key
Addresses the first half of #3629 by ensuring that the reconstructed
HashMap always has the 32-byte key for each payload.

It turns out, the TempProposalStore persists the ProtectedStorageEntrys
on-disk as a List and doesn't persist the key at all. Then, on
reconstruction, it creates the 20-byte key for its internal map.

The fix is to update the TempProposalStore to use the 32-byte key instead.
This means that all writes, reads, and reconstrution of the TempProposalStore
uses the 32-byte key which matches perfectly with the in-memory map
of the P2PDataStorage that expects 32-byte keys.

Important to note that until all seednodes receive this update, nodes
will continue to have both the 20-byte and 32-byte keys in their HashMap.
2019-11-20 16:15:52 -08:00
Dimitris Apostolou
587b55d37b
Fix typos and cleanup 2019-11-20 22:56:19 +02:00
Julian Knutsen
a8139f3a04
Remove HashmapChangedListener::onBatch operations
Now that the only user of this interface has been removed, go ahead
and delete it. This is a partial revert of
f5d75c4f60 that includes the code that was
added into ProposalService that subscribed to the P2PDataStore.
2019-11-19 08:37:40 -08:00
Julian Knutsen
a50e59f7eb
ProposalService::onProtectedDataRemoved signals listeners once on batch removes
#3143 identified an issue that tempProposals listeners were being
signaled once for each item that was removed during the P2PDataStore
operation that expired old TempProposal objects. Some of the listeners
are very expensive (ProposalListPresentation::updateLists()) which results
in large UI performance issues.

Now that the infrastructure is in place to receive updates from the
P2PDataStore in a batch, the ProposalService can apply all of the removes
received from the P2PDataStore at once. This results in only 1 onChanged()
callback for each listener.

The end result is that updateLists() is only called once and the performance
problems are reduced.

This removes the need for #3148 and those interfaces will be removed in
the next patch.
2019-11-19 08:37:39 -08:00
Julian Knutsen
b281566e14
[REFACTOR] HashMapListener::onAdded/onRemoved
Previously, this interface was called each time an item was changed. This
required listeners to understand performance implications of multiple
adds or removes in a short time span.

Instead, give each listener the ability to process a list of added or
removed entrys which can help them avoid performance issues.

This patch is just a refactor. Each listener is called once for each
ProtectedStorageEntry. Future patches will change this.
2019-11-19 08:37:38 -08:00
Justin Carter
80fda1ec2c
Inject CoinFormatter via BTC_FORMATTER_KEY 2019-11-19 15:54:18 +01:00
Justin Carter
68a988b3a8
Remove dead code 2019-11-19 14:24:30 +01:00
Justin Carter
cb8873fa6d
Move BsqFormatter and ImmutableCoinFormatter under .coin package 2019-11-19 14:23:18 +01:00
Justin Carter
d23ae558e7
Rename BSFormatter to ImmutableCoinFormatter 2019-11-19 14:11:01 +01:00
Justin Carter
ed97f7a9e5
Use interface instead of class name for CoinFormatter 2019-11-19 14:00:22 +01:00
Justin Carter
d10683e192
Extract CoinFormatter interface 2019-11-19 12:30:31 +01:00
Justin Carter
2f7a924792
Remove dead code from BSFormatter 2019-11-19 12:18:10 +01:00
Christoph Atteneder
8c8c7117d3
Refactorings for api support (#3611)
* Remove trailing spaces

* Add toProtoTradeStatistics2 method

API will use getTradeStatistics and expect TradeStatistics2 not
PersistableNetworkPayload

* Add CreateOfferService class

* Remove commented out code

* User weaker access, add final

* Add getRandomOfferId method

* Add getSellerSecurityDeposit method

* Add getEstimatedFeeAndTxSize method

- Rename estimateTxSize to updateEstimatedFeeAndTxSize
- Add getEstimatedFeeAndTxSize method to CreateOfferService
- Add dependent methods and fields

* Use methods from createOfferService

- Use getBuyerSecurityDepositAsCoin and getSellerSecurityDepositAsCoin
from CreateOfferService

* Use txFeeFromFeeService from createOfferService

- Use getEstimatedFeeAndTxSize from CreateOfferService for
txFeeFromFeeService

* Use getPriceAsLong from createOfferService

* Use marketPriceMarginParam from createOfferService

* Pass useMarketBasedPriceValue to getPriceAsLong

* Use getMaxTradeLimit from createOfferService

* Use createAndGetOffer from createOfferService

* Remove unused fields

* Add createOfferService, remove unused params

* Use weaker access

* Add null checks

* Add log of params, Cleanup

* Remove unused fields

* Use weaker access

* Remove trivial methods

* Remove trivial methods, rename methods

* Sort params for offer as they are used

* Use getReservedFundsForOffer from createOfferService

* Add MakerFeeProvider

* Adjust to new super class params

* Remove sellerSecurityDeposit field, refactor placeOffer

* Adjust tests to new params
2019-11-19 09:49:38 +01:00
Justin Carter
cfaa23effc
Move functions that only have 1 call-site out of BSFormatter
Make them private instance functions at call site to minimize
dependencies.
2019-11-19 09:24:06 +01:00
Justin Carter
dc741984ce
Move Currency related helpers out of BSFormatter to CurrencyUtils 2019-11-19 09:24:05 +01:00
Justin Carter
06c2fa5ea0
Remove dead Code from BSFormatter 2019-11-19 09:24:05 +01:00
Justin Carter
df6812a4c9
Extract FormattingUtils from BSFormatter
All formatting related functions that are depended on by core and
desktop jars are extracted to the new class FormattingUtils.
2019-11-19 09:23:57 +01:00
Christoph Atteneder
7c83230724
Merge pull request #3625 from rafaelpac/account-validation-bug
[BUGFIX] Account validation comparing user trade limit with MAX amount of offer
2019-11-18 16:00:01 +01:00
Christoph Atteneder
ec5e2b76d4
Avoid unchecked casts/assignments/calls (#3626)
* Don't extend ActivatableViewAndModel when the model is empty

Remove the no-arg constructor from ActivatableViewAndModel, which sets
a dummy Activatable singleton as the model. (Since the model type param
can't be checked at runtime, improper use of the constructor could cause
heap pollution.)

Instead, extend 'ActivatableView<R, Void>' consistently, as other views
without a model currently do.

* Improve type safety of the fluent interface of Overlay<T>

Refactor all the unchecked casts from Overlay<T> to T into a single
private cast() method. Also add a runtime type check to the constructor
to prevent creation of window objects of the form "A extends Overlay<B>"
for unrelated A & B, as such casts would then subvert the type system.

* Improve type safety of ProtoUtil.collectionToProto(Collection)

Add a Class<T> parameter to the method, in order to avoid an unchecked
cast to the Message type T. The cast was wrapped in a try-catch block,
which is useless due to erasure, so use Class.cast(..) instead.

* Avoid raw types to prevent unchecked casts in Log.java

Add missing ILoggingEvent type arg to local variable declarations.

* Avoid unchecked casts when deserializing JSON using Gson

* Fix unchecked casts in views due to raw chart point types

Add missing 'Number' coord type args to some XYChart.(Data|Series) &
AreaChart declarations, and avoid passing them as generic varargs, in
order to eliminate some more unchecked cast warnings.

Also simplify OfferBookChartView.updateChartData() by unboxing the x-
coordinate of each (buy & sell) datapoint.

* Avoid raw type bounds in class declarations to fix unchecked warnings

Make sure the generic classes MutableOfferView & AgentRegistrationView
don't use raw bounds for their associated view models, as that leads to
unchecked assignments from the model fields further down.

* Fix some remaining suppressed unchecked casts in the UI logic

(This still leaves a few more which are hard to avoid.)

* Fix a few remaining unsuppressed unchecked warnings
2019-11-18 15:41:23 +01:00
Christoph Atteneder
b38c695a86
Merge pull request #3568 from julianknutsen/manual-clock-in-tests
(5/8) Test P2PDataStore expiration code and make testing time sensitive code easier.
2019-11-18 11:31:19 +01:00
Pac
894a2c6b90
[BUGFIX] Account validation was comparing user trade limit with MAX amount of offer
Fixes issues #3601 and #3537.
The bug only happens when the offer has MIN-MAX value range.
The new isAmountValidForOffer in PaymentAccountUtil.java consider only the MAX amount, but the button to take the offer is ungrayed considering the MIN amount, which causes the bug.
2019-11-17 19:24:22 -03:00
Steven Barclay
5e69073280
Fix a few remaining unsuppressed unchecked warnings 2019-11-17 22:00:40 +00:00
Steven Barclay
77a8c20ce9
Avoid unchecked casts when deserializing JSON using Gson 2019-11-17 01:25:11 +00:00
Steven Barclay
dd6db4687c
Improve type safety of ProtoUtil.collectionToProto(Collection)
Add a Class<T> parameter to the method, in order to avoid an unchecked
cast to the Message type T. The cast was wrapped in a try-catch block,
which is useless due to erasure, so use Class.cast(..) instead.
2019-11-17 01:25:10 +00:00
chimp1984
9092160700
Adjust tests to new params 2019-11-15 00:03:52 -05:00
chimp1984
50fc1393e0
Remove sellerSecurityDeposit field, refactor placeOffer 2019-11-14 23:58:31 -05:00
chimp1984
41535fb7d4
Add MakerFeeProvider 2019-11-14 23:56:11 -05:00
chimp1984
84b49eda14
Sort params for offer as they are used 2019-11-14 23:33:11 -05:00
chimp1984
018cccfe03
Remove trivial methods, rename methods 2019-11-14 23:26:45 -05:00
chimp1984
98c2601a36
Remove trivial methods 2019-11-14 23:24:38 -05:00
chimp1984
a881519857
Use weaker access 2019-11-14 23:21:34 -05:00