Commit Graph

11607 Commits

Author SHA1 Message Date
chimp1984
46394024e9
Dont restart seed if localhost is used 2020-09-01 19:15:06 -05:00
chimp1984
28c8150b6b
Refactoring
This is another larger refactoring, sorry ;-)

But the structure was just not correct before. We had handled multiple
trades with multiple results and that is error prone. Now each class
has much more clear responsibilities. Also the result enums are not
changes so that they are better separated between result based and
service bases states.

All different states are still hard to test. We should set up some mock
service to simulate confirmations counting up and error scenarios.
2020-09-01 19:10:43 -05:00
chimp1984
10dcc70538
Change log level if banned seed or price relay is seen from filter.
Change log text.

Those banned nodes are quite old and no need to restart the app. In case
we need to really ban a node (the one we banned are just revoked) we can
use the global notification to alert users to restart.
2020-09-01 17:14:01 -05:00
chimp1984
512f1a5972
Refactor AutoConfirmSettings handling in preferences
- Do not use immutability for AutoConfirmSettings as it makes setting
values cumbersome.

- Add btc validator for trade limit

- Make AutoConfirmSettings an optional and add find method by currency
code to be better prepared when used for other coins.

- Add static getDefaultForXmr to AutoConfirmSettings

- Move listener creation to init method
2020-09-01 16:00:02 -05:00
chimp1984
580b05968f
Increase timeouts from 10 sec to 30 sec.
Over tor connections are slower.

Use TimeUnit.SECONDS.toMillis() for better readability and
making it more clear whats the unit used in the method.
2020-09-01 11:43:56 -05:00
chimp1984
3b4e183633
Use tradeId for prefix for id of request.
Remove testKey test (tested uid of model)

Refactor:
- Rename uid to id (we do not have a strict guarantee for uniqueness)
- Move id from model to request (its the id of the request)
2020-09-01 11:18:09 -05:00
chimp1984
77841e230f
Change log level
In cased new fields are added to PB this case is expected as well in
development if protbuf definitions have changed over time and persisted
data do not match the new definition. We don't want this log to be
that verbose.
2020-09-01 10:58:00 -05:00
chimp1984
3ec216dcd6
Replace Exception with CryptoNoteException (codacy complaint) 2020-09-01 10:47:28 -05:00
chimp1984
6cc074a15c
Add default clause (codacy complaint) 2020-09-01 10:44:50 -05:00
chimp1984
123183e5e1
Remove CryptoNoteException again as it caused failed tests
Damn codacy forces one to not use Exception ;-(
2020-09-01 01:24:14 -05:00
chimp1984
d36306a73c
More refactoring.... 2020-09-01 00:56:54 -05:00
chimp1984
4323b417b1
Adjust to codacy complaints
codacy does not like raw Exceptions ;-(

- Remove unused method
2020-08-31 19:36:19 -05:00
chimp1984
7b3dc54815
dont use restart routing for seed nodes if in devmode 2020-08-31 19:29:56 -05:00
chimp1984
12ef5aafe0
Update comment 2020-08-31 16:25:07 -05:00
chimp1984
e9e7b489be
Various refactorings, bug fixes and improvements.
Sorry for the messy commit... its late ;-)
2020-08-31 00:10:41 -05:00
chimp1984
4f0e574bf9
Use static field for dev test values 2020-08-30 21:38:32 -05:00
chimp1984
2967530878
Max amount was set to 0.1 BTC, should be 1 BTC 2020-08-30 21:37:17 -05:00
chimp1984
aab478a63c
Refactor:
- Rename XmrAutoConfirmationManager to XmrTxProofService
2020-08-30 19:38:29 -05:00
chimp1984
f3ad669fab
Refactor:
- Rename XmrTransferProofService to XmrTxProofRequestService
2020-08-30 19:38:05 -05:00
chimp1984
0e2268d6fe
Refactor:
- Rename XmrTransferProofRequest to XmrTxProofRequest
2020-08-30 19:37:43 -05:00
chimp1984
a758880211
Refactor:
- Rename XmrProofInfo to XmrTxProofModel
2020-08-30 19:37:22 -05:00
chimp1984
87070531dd
Refactor:
- Rename XmrProofParser to XmrTxProofParser (and rename test)
2020-08-30 19:36:54 -05:00
chimp1984
44782223ec
Refactor:
- Rename XmrAutoConfirmResult to XmrTxProofResult
2020-08-30 19:35:56 -05:00
chimp1984
f8b5c30fb4
Refactor:
- Rename AutoConfirmResult to AssetTxProofResult
- Update protobuf entry
2020-08-30 19:35:26 -05:00
chimp1984
40a7320f32
Refactor:
- Rename XmrTransferProofRequester to XmrTransferProofRequest
2020-08-30 19:25:02 -05:00
chimp1984
6f56f90a66
Refactor:
- Rename processCounterCurrencyExtraData to startRequestTxProofProcess
- Change activeTrades from Stream to List
2020-08-30 19:23:41 -05:00
chimp1984
0740f8d12b
Remove @nullable from socks5ProxyProvider param
Remove @Inject from XmrTxProofHttpClient as we pass the
Socks5ProxyProvider anyway
2020-08-30 19:15:32 -05:00
chimp1984
ef9ac12519
Refactoring:
-Reduce visibility
2020-08-30 19:09:04 -05:00
chimp1984
b76357e620
Refactoring:
Change test package from bisq.core.trade.asset.xmr to bisq.core.trade.autoconf.xmr
2020-08-30 19:07:04 -05:00
chimp1984
213dffbef9
Refactoring:
- Rename getKey to getUID
- Rename key to uid
2020-08-30 19:05:18 -05:00
chimp1984
c6c8a3e5cb
Refactoring:
- Move xmrProofInfo.checkApiResponse to XmrProofParser.parse
2020-08-30 19:03:37 -05:00
chimp1984
38ac145213
Add devMode check for NO_MATCH case.
Inline method
2020-08-30 17:56:44 -05:00
chimp1984
867e023e87
Merge branch 'master_upstream' into add-xmr-tx-key-service-3 2020-08-30 17:02:15 -05:00
chimp1984
2a887e1f01
Improve SetXmrTxKeyWindow 2020-08-30 17:01:21 -05:00
chimp1984
94c84b6f50
Add @Override, cleanup 2020-08-30 16:47:39 -05:00
chimp1984
2fb625642a
Refactoring: Rename getTextStatus to getStatusAsDisplayString 2020-08-30 16:45:46 -05:00
chimp1984
595c968f2d
Various small cleanups... 2020-08-30 16:44:45 -05:00
chimp1984
67723fa1a7
Do not pass over xmrAutoConfirmationManager to ProcessModel but use a
getter from tradeManager. Avoids boilerplate code (I know there is more
in the existing code to optimize here ;-))
2020-08-30 16:43:32 -05:00
chimp1984
219094e9d1
Merge branch 'add-xmr-tx-key-service-2' into add-xmr-tx-key-service-3 2020-08-30 16:11:12 -05:00
chimp1984
77c203e87e
No functional change, pure refactoring
Move to convertToRawHex CryptoNoteUtils as well as the classes inside
the validator.
2020-08-30 16:08:07 -05:00
chimp1984
5143b1ed59
Apply suggested changes from code analysis 2020-08-30 15:56:44 -05:00
chimp1984
bfab6ffc2e
Replace success/failure with booleans 2020-08-30 15:51:43 -05:00
chimp1984
e5aee1ca07
No functionality has been changed by that refactoring, just moved
classes and renamed package and adjusted access modifiers.
2020-08-30 15:50:15 -05:00
chimp1984
ed5078c0f1
Add abstract AutoConfirmResult class to get better support if we want
to add auto confirm for other currencies in the future. The generic part
is only used where we would have issues with backward compatibility like
in the protobuf objects. Most of the current classes are kept XMR
specific and could be generalized once we add other assets, but that
would be an internal refactoring without breaking any network or
storage data. I think it would be premature to go further here as we
don't know the details of other use cases. I added the methods used from
clients to AutoConfirmResult, not sure if the API is well defined by
that, but as said that could become subject of a future refactoring once
another auto confirm feature gets added. Goal of that refactoring was
to avoid that we need more fields for trade and the the UI would have to
deal with lots of switch cases based on currency.

Sorry that is a larger commit, would have been hard to break up...
2020-08-30 15:45:47 -05:00
chimp1984
2f1566bb06
Add NO_MATCH_FOUND in comment 2020-08-30 14:48:15 -05:00
chimp1984
2f7b24d1c8
- Add @Nullable
- Add curly brackets to one liners
- Log improvements
2020-08-30 14:46:04 -05:00
chimp1984
07a761255d
- Make REPEAT_REQUEST_PERIOD and MAX_REQUEST_PERIOD static
- Replace httpClient.toString() with httpClient.getBaseUrl() as toString
would deliver too much for those use cases.
- Add @Nullable
- Log improvements
2020-08-30 14:45:05 -05:00
chimp1984
2dbc4645ec
- Change tolerance from 1 day to 2 hours.
- Add case if no match is found -> NO_MATCH_FOUND.
- Add test case for NO_MATCH_FOUND
- Add curley brackets to one liners
- Log improvements
2020-08-30 14:42:52 -05:00
chimp1984
008ae93b88
Add null check for name 2020-08-30 14:40:21 -05:00
chimp1984
3e728c69f7
- Remove AutoConfirmResult enum from protobuf and add a AutoConfirmResult
instead which stores the stateName. [1]

- Adjust protobuf methods

- Add UNDEFINED to AutoConfirmResult.State to support cases where we
get no data to set the enum.

- Add NO_MATCH_FOUND (used in follow up commits)

- Refactoring: Improve constructors

[1]
Enums in protobuf are not well supported. They are global so an enum
with name (e.g. State) inside Trade conflicts with another enum inside
Message with the same name. So they do not reflect encapsulation in the
class like in java.
We moved over time to the strategy to use strings (from enum.name())
instead of the enum, avoiding also cumbersome fromProto and toProto
code and being more flexible with updates.
The autoConfirmResultState enum inside Trade was a bit confusing to me
as it was a different structure as in the java code. We try to mirror
the structure as far as possible.
2020-08-30 14:39:44 -05:00