Commit graph

12455 commits

Author SHA1 Message Date
ghubstan
9999c95a9e
Change 'createoffer' argument order
And list the args in CLI --help outout.
2020-09-24 13:48:50 -03:00
jmacxx
b842a0789c
XMR autoconf should get amount from trade not offer
Get the amount from the trade rather than the offer.

Log the expected amount when not matching the explorer result.
It would have made debugging this issue much more straightforward.

Fixes #4557
2020-09-24 10:57:33 -05:00
ghubstan
ec9c1b0f10
Uppercase direction & ccy-code CLI arguments in core
Don't convert parameter case in CLI.
2020-09-24 09:18:13 -03:00
chimp1984
03023567a8
Fix potential bug with peers pub key check. Use new isPubKeyValid method to avoid code duplication.
Before we did not apply messages if the peers key was null which can be the case at protocol start for maker side (takers key is not set yet). Makers key is in offer and available from the start.

Fix incorrect setPubKeyRing call in BuyerAsTakerProtocol and BuyerProtocol. Only taker can set it from offer. This bug was introduce in past commits of this branch.

Move FluentProtocol to own class file
Close open offer in task instead at state listener
Remove state listener
Remove default timeout as not used anymore
Add onWithdrawCompleted method to clean up when trade completed
Rearrange code in TradeProtocol
Rename doHandleDecryptedMessage to onTradeMessage
Rename doApplyMailboxTradeMessage to onMailboxMessage
2020-09-23 22:24:45 -05:00
chimp1984
f059f08b27
Refactor: Rearrange methods 2020-09-23 19:56:41 -05:00
chimp1984
9644920a52
Refactor: Move mediation code to new class 2020-09-23 19:52:24 -05:00
chimp1984
8847f4b13d
Refactor: Rename createTrade to getNewTrade
Move some code to caller method
2020-09-23 19:35:19 -05:00
chimp1984
99afe23de6
Refactor: Rename takeAvailableOffer to onTakeOffer 2020-09-23 19:29:29 -05:00
chimp1984
a2e0ec4d2e
Change SellerProtocol from interface to abstract class
Move all common code of seller protocol classes to SellerProtocol
2020-09-23 19:26:49 -05:00
ghubstan
a6048a4f7d
Add comment to empty catch block for codacy 2020-09-23 20:43:56 -03:00
ghubstan
c8a7fe4b97
Print createoffer's reply in the CLI's console 2020-09-23 19:57:22 -03:00
ghubstan
d5b8800ba4
Add license comment and btc-string to satoshi converter
The converter is needed for CLI, which has no access to core or
common utils.
2020-09-23 19:52:37 -03:00
ghubstan
1431a076b2
Add license comment 2020-09-23 19:51:40 -03:00
ghubstan
adb175c21a
Add options helper for handling negative number CLI params 2020-09-23 19:50:04 -03:00
chimp1984
e59b5b3cf5
Change BuyerProtocol from interface to abstract class
Move all common code of buyer protocol classes to BuyerProtocol
2020-09-23 17:20:10 -05:00
chimp1984
cdbd6cdfa8
Redesigned fluent API again...
Move code duplication to Buyer protocol
2020-09-23 16:21:29 -05:00
chimp1984
54d625e564
Add run method to accept runnable which is execute before run tasks
Add isValid method in FluentProcess
Add more logs if invalid
Add toString

Refactor:
- Remove custom trade fields and use trade from base class instead
2020-09-23 13:08:26 -05:00
chimp1984
968a6df550
Refactor: Rename run to runTasks 2020-09-23 12:50:22 -05:00
chimp1984
9505179bed
Use FluentProcess for boilerplate code (WIP - some custom code is commented out atm, will be fixed in follow up commits)
Add setTaskRunner method
Add addTasks method
Add run method
2020-09-23 12:49:42 -05:00
chimp1984
faf07f623f
Refactor: Rename fromAny to expectedPhases 2020-09-23 12:14:40 -05:00
chimp1984
d91e44c9ab
Refactor: Rename from to expectedPhase 2020-09-23 12:14:18 -05:00
chimp1984
3f80d1b1ea
Refactor: Rename condition to preCondition 2020-09-23 12:13:07 -05:00
chimp1984
2b53312af9
Various improvements
- Add time outs per request/response cycle.
- Use custom timeouts
- Stop timeout if condition not met
- Allow multiple condition calls (all need to be true)
- Move  processModel.setTradeMessage(tradeMessage); and processModel.setTempTradingPeerNodeAddress(peerNodeAddress); calls to FluentProcess
- Add Validator.isTradeIdValid method
- Replace Validator.checkTradeId(processModel.getOfferId(), tradeMessage); by isTradeIdValid in FluentProcess
- Add DisputeEvent
- Derive info string from message or event at handleTaskRunnerSuccess
- Add from method
- Add withTimeout method
- Add BuyerEvent.STARTUP
- Rename onMessage to on
- Rename onEvent to on
- Rename tradeMesage to message
- Rename sener/peerNodeAddress to peer
2020-09-23 12:07:38 -05:00
sqrrm
9ca3c8bded
Merge pull request #4549 from oscarguindzberg/fixlog
Fix logging message
2020-09-23 16:57:27 +02:00
chimp1984
de008457cb
Remove empty file (from merge) 2020-09-23 08:28:04 -05:00
chimp1984
0fa45650b6
Merge branch 'dispute-agent-branch' into wip-merge-tradeprot
# Conflicts:
#	core/src/main/java/bisq/core/trade/DelayedPayoutTxValidation.java
#	core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerVerifiesFinalDelayedPayoutTx.java
#	desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java
#	desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep1View.java
#	desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep2View.java
2020-09-23 08:27:09 -05:00
chimp1984
6fa2225b65
Use fluent interface for checking state and conditions 2020-09-23 01:48:02 -05:00
chimp1984
7c6f0ac9b2
Use ifInPhase APi for testing expected phase(s)
Add ifInPhase method to allow alternative phases. We can have parallel branches how we reach a new state, e.g. receiving the tx from network or receiving it from the peer. no guarantee which will happen first.

Allow phase transition to skip a future phase as we have phases only relevant for one role. This is not good for treading it as a state machine state, we need to redesign the state/phase handling...
2020-09-22 21:09:09 -05:00
ghubstan
d190d09e2b
Fix unnecessary use of fully qualified name 2020-09-22 22:58:32 -03:00
ghubstan
fc1f0bac60
Fix imports 2020-09-22 22:56:08 -03:00
chimp1984
48241af316
Change isTradeInPhase APi to fluent interface with ifInPhase 2020-09-22 20:18:59 -05:00
ghubstan
70e3be0032
Add API CreateOfferTest case 2020-09-22 22:16:55 -03:00
ghubstan
3c0c443680
Change API's createoffer return value from bool to Offer 2020-09-22 22:13:42 -03:00
ghubstan
2b68e57273
Stub out createoffer method in CLI 2020-09-22 22:09:58 -03:00
ghubstan
92f36ed03a
Add get default payment acct helper 2020-09-22 22:08:01 -03:00
chimp1984
5f8f30a8b3
Add BuyerSendCounterCurrencyTransferStartedMessage as second optional task instead of starting a new task runner 2020-09-22 19:53:19 -05:00
chimp1984
1abe6adac6
Remove empty tasks. 2020-09-22 19:40:15 -05:00
chimp1984
8ce5ebadea
Refactoring: rename, cleanups 2020-09-22 19:35:24 -05:00
chimp1984
4b7307e07f
Add checks for state at handle CounterCurrencyTransferStartedMessage
Add ApplyFilter task
2020-09-22 19:35:01 -05:00
chimp1984
c7e0c51875
Use same model as in SellerSendsDepositTxAndDelayedPayoutTxMessage
Reason: the other model was already tested quite a lot and seems to work correctly.
We gain a lot of resiliance with min. costs (repeated mailbox messages - as they are the same
they will not cause higher number of msg, just a bit more traffic)
2020-09-22 19:34:14 -05:00
chimp1984
96221317e2
Change order of tasks
Call BuyerSetupPayoutTxListener before BuyerSendCounterCurrencyTransferStartedMessage
We will change BuyerSendCounterCurrencyTransferStartedMessage so that it
does not complete until the message has been ACKed by the peer.
It is more transparent to leave the task uncompleted and if it is the last task we dont have issues.
The caller would not get the result handler called though until all is completed. But the result handler in the UI was anyway empty.
2020-09-22 19:01:51 -05:00
chimp1984
b13e1a3edb
Resend DepositTxAndDelayedPayoutTxMessage at
SellerSendsDepositTxAndDelayedPayoutTxMessage if no ACK received

Add checks for valid trade state transitions
2020-09-22 18:50:45 -05:00
chimp1984
2b747cc323
Don't return null if name is null by try to use UNDEFINED. Only if that is not present we return null 2020-09-22 18:48:47 -05:00
ghubstan
e63a6c5771
Remove comment 2020-09-22 18:45:50 -03:00
ghubstan
c4dd041d97
Don't use static boilerplate helpers if not necessary 2020-09-22 18:20:23 -03:00
ghubstan
1d88d27330
Remove final modifiers 2020-09-22 18:11:55 -03:00
ghubstan
6a5040228e
Add simple create payment acct test
And make test dispute agent registration work from static fixture
setup methods.
2020-09-22 18:05:09 -03:00
ghubstan
1f307c8263
Fix indentation 2020-09-22 16:31:31 -03:00
ghubstan
8896372a0f
Move test dispute agent type constants to core
The string constants deleted from the test case are re-defined as enums,
but the test harness still passes around strings (enum.name()) because
the handling of invalid dispute agent type string args needs to be
tested.  (Reminder:  CLI does not accept any enum arguments.)
2020-09-22 15:31:38 -03:00
Oscar Guindzberg
abcd065325
DAO setup doc fix
Stress a full dao seed node is required to run lite nodes.
2020-09-22 15:24:23 -03:00