Commit graph

4856 commits

Author SHA1 Message Date
chimp1984
f1df52790b
improve trade details window 2020-09-25 00:20:17 -05:00
chimp1984
6f614f4f4c
Set takerFeeTxId and depositTx in trade only once they are published. Before that we keep it temporary in the processModel.
The buyer receives the takerFeeTxId with the frist message, but at the moment it is not published. To reflect that he also keeps it in the process model and
at the next message when the fee tx is published he sets it in the Trade.

Remove
`checkArgument(!walletService.getAddressEntry(id, AddressEntry.Context.MULTI_SIG).isPresent(),
                     "addressEntry must not be set here.");
`
as it causes failure if a taker takes same offer after certain error conditions again.
2020-09-25 00:19:43 -05:00
chimp1984
b494434623
Add warn icon next to trash icon. Show popup with info about the problem and instructions.
Set trash button disabled if the tx chain is valid to avoid that users move to failed while trade is valid to be completed.

Contract: Add isMyRoleMaker method
Trade: Add hasErrorMessage and isTxChainInvalid methods
2020-09-24 21:07:40 -05:00
chimp1984
f6eefef1ae
Remove handling of failed trades. If a trade is in an invalid state (tx missing) or has an error message set we show in the pending trades view a red trash icon for moving the trade to failed trades.
The info icon next to the trade ID is then a warning icon (should be red but css is not my best friend) and if opening trade details window we also color the missing txs red with a warn icon and tooltip.
When clicking the trash button a popup is displayed with detail info.
At failed trades there is a "undo" icon for reverting the trade back to pending (if user wants to open mediation, etc).

All the automatic handling of the failed trades and popups are removed as it never worked well and just confused users...

In next commits we will add more instructions what a user should/can do for diff. error cases.

TradeManger:
- Remove all the failed checks at initPendingTrade.
- Remove tradesWithoutDepositTx
- Remove tradesForStatistics as it was never read
- Remove cleanUpAddressEntries
- Rename addTradeToClosedTrades to onTradeCompleted

TxIdTextField accepts a null for tx ID and shows then red colored N/A and a warning icon.
HyperlinkWithIcon exposed the icon to be accessible for style change.
DebugWindow was updated for one variation of the trade protocol (other is missing still).
Trade detail window show now always all 4 mandatory txs.
Beside that this commit has some cleanups and null pointer fixes (when testing error scenarios i got those NP).
2020-09-24 19:47:12 -05:00
ghubstan
6cdbc137c1
Move 'createoffer' price arg transform to server & test it
The CreateOfferRequest's price field type was changed from long to string,
so a CLI param like 10000.0055 can be passed to the server as is, to be
scaled and converted there.  In general, we want to keep validation logic
on the CLI as simple as possible, and use existing core logic to
validate args and convert arg types when needed.
2020-09-24 18:13:19 -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
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
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
chimp1984
48241af316
Change isTradeInPhase APi to fluent interface with ifInPhase 2020-09-22 20:18:59 -05:00
ghubstan
3c0c443680
Change API's createoffer return value from bool to Offer 2020-09-22 22:13:42 -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
ghubstan
e63a6c5771
Remove comment 2020-09-22 18:45:50 -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
6ba0d6197e
Remove unnecessary comment 2020-09-22 15:06:43 -03:00
Oscar Guindzberg
f529e463d3
Remove unnecessary code 2020-09-22 15:06:43 -03:00
Oscar Guindzberg
ab4333eaaa
Rename kcg to kcgBuilder 2020-09-22 15:06:43 -03:00
Oscar Guindzberg
4558bf4c0c
Remove unused imports 2020-09-22 15:06:42 -03:00
Oscar Guindzberg
1becf89371
Remove unused WalletConfig.walletFactory 2020-09-22 15:06:42 -03:00
Oscar Guindzberg
59124e3e33
Replace deprecated bitcoinj methods
Replace output.getAddressFromP2PKHScript() and
output.getAddressFromP2SH() with
output.getScriptPubKey().getToAddress()
2020-09-22 14:55:47 -03:00
Oscar Guindzberg
c1c9ff3de8
Fix logging message 2020-09-22 14:07:31 -03:00
Christoph Atteneder
e3b3c625b3
Merge pull request #4548 from ghubstan/use-legacyaddress-frombase58
Remove unused, broken accessor
2020-09-22 16:32:50 +02:00
Christoph Atteneder
44bf29b67e
Merge pull request #4546 from oscarguindzberg/code-cleanup
Minor code cleanup changes
2020-09-22 16:23:31 +02:00
Christoph Atteneder
64d4b9b136
Merge pull request #4544 from oscarguindzberg/removeListeners
Remove unnecessary listeners in TransactionsView
2020-09-22 16:22:37 +02:00
Christoph Atteneder
69d533d9ea
Merge pull request #4520 from cd2357/show-qubes-info-popup
Show info popup if Bisq started under Qubes OS
2020-09-22 16:21:03 +02:00
ghubstan
86c62c1333
Revert WalletService change (accessor breaks build)
The accessor added in commit e2bd89f broke the build, and was not
used as originally intended -- by CoreWalletsService -- because the
the api's wallet methods need addresses from the wallet, not just
a valid address.
2020-09-22 11:16:53 -03:00
sqrrm
3d07c064e4
Merge pull request #4534 from ghubstan/daemon-status-scratch
Give core api a simple way to verify init status
2020-09-22 11:41:12 +02:00