Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New trade protocol #3333

Merged
merged 46 commits into from Sep 27, 2019
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2c89c5d
Remove arbitration key, cleanup
chimp1984 Sep 21, 2019
edf71f2
Add BuyerAsMakerProcessDepositTxAndDelayedPayoutTxMessage
chimp1984 Sep 21, 2019
32ec5f6
Adopt trade protocol
chimp1984 Sep 21, 2019
13fda96
Remove arbitratorKey
chimp1984 Sep 21, 2019
7393262
Add new classes
chimp1984 Sep 21, 2019
5610c0e
Add new message classes
chimp1984 Sep 21, 2019
7774abe
Add new task classes
chimp1984 Sep 21, 2019
59a47d0
Renamed classed (no functional change yet)
chimp1984 Sep 21, 2019
0401045
Add lockTime
chimp1984 Sep 21, 2019
6b40c5d
Add delayedPayoutTxSignature field
chimp1984 Sep 21, 2019
db5884c
Add useReimbursementModel field
chimp1984 Sep 21, 2019
e937869
Add new classes
chimp1984 Sep 21, 2019
d8d7f34
Add setting.preferences.useReimbursementModel
chimp1984 Sep 21, 2019
2a3ba2b
Apply renamed classes (new classes not added yet)
chimp1984 Sep 21, 2019
0232ac9
Add useReimbursementModel
chimp1984 Sep 21, 2019
24761d9
Add preferences param
chimp1984 Sep 21, 2019
16a8dac
Add new methods, cleanup
chimp1984 Sep 21, 2019
1cc4205
Add daoFacade param, apply renaming
chimp1984 Sep 21, 2019
90bc4d5
Add delayedPayoutTx, lockTime and delayedPayoutTxId
chimp1984 Sep 21, 2019
d9ccf94
Remove DirectMessage interface
chimp1984 Sep 21, 2019
e75f2a5
Rename emergencySignAndPublishPayoutTx method, add new one for 2of2 MS
chimp1984 Sep 21, 2019
0b8e2e9
Apply new protocol
chimp1984 Sep 21, 2019
57f8f16
Apply new protocol
chimp1984 Sep 21, 2019
ff78aa5
Add renaming (no functional change yet)
chimp1984 Sep 21, 2019
44975be
Add new messages, apply renaming
chimp1984 Sep 21, 2019
82736de
Remove unneeded P2SHMultiSigOutputScript
chimp1984 Sep 21, 2019
3f7dfc6
Remove PREFERRED_PROJECT_CODE_STYLE
chimp1984 Sep 21, 2019
4b94412
Refactor: Rename class
chimp1984 Sep 21, 2019
5bd5d0c
Use InputsForDepositTxRequest instead of TradeMessage in handleTakeOf…
chimp1984 Sep 21, 2019
05a9703
Do not sign deposit tx if maker is seller
chimp1984 Sep 21, 2019
5aa185c
Apply new trade protocol to seller as maker version
chimp1984 Sep 21, 2019
c41b811
Apply new trade protocol
chimp1984 Sep 22, 2019
4de69a6
Set TRADE_PROTOCOL_VERSION to 2
chimp1984 Sep 22, 2019
ab63cad
Add PeerPublishedDelayedPayoutTxMessage
chimp1984 Sep 22, 2019
7988a97
Add refund agent domain
chimp1984 Sep 23, 2019
160c135
Add refundAgentNodeAddress
chimp1984 Sep 23, 2019
f12bf51
Apply refund domain
chimp1984 Sep 23, 2019
68bb842
Add refund views
chimp1984 Sep 23, 2019
912bb07
Apply refundAgent domain
chimp1984 Sep 23, 2019
8a17cc5
Support refundAgent
chimp1984 Sep 24, 2019
172330a
Remove useReimbursementModel field
chimp1984 Sep 24, 2019
1c5d9ef
Apply refundAgent payout
chimp1984 Sep 26, 2019
0300836
Handle tx info and balances
chimp1984 Sep 26, 2019
038347a
Remove mediation activation
chimp1984 Sep 26, 2019
d388d9a
Add new tac accepted flag for v1.2.0 and adjust text
chimp1984 Sep 26, 2019
a30a07e
Fix params for test classes
chimp1984 Sep 26, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Apply new protocol

  • Loading branch information
chimp1984 committed Sep 21, 2019
commit 0b8e2e990f75a99ff9619d19915cc4b0d96ea7fb
@@ -21,7 +21,8 @@
import bisq.core.trade.SellerAsTakerTrade;
import bisq.core.trade.Trade;
import bisq.core.trade.messages.CounterCurrencyTransferStartedMessage;
import bisq.core.trade.messages.PublishDepositTxRequest;
import bisq.core.trade.messages.DelayedPayoutTxSignatureResponse;
import bisq.core.trade.messages.InputsForDepositTxResponse;
import bisq.core.trade.messages.TradeMessage;
import bisq.core.trade.protocol.tasks.ApplyFilter;
import bisq.core.trade.protocol.tasks.PublishTradeStatistics;
@@ -31,13 +32,19 @@
import bisq.core.trade.protocol.tasks.seller.SellerSendPayoutTxPublishedMessage;
import bisq.core.trade.protocol.tasks.seller.SellerSignAndFinalizePayoutTx;
import bisq.core.trade.protocol.tasks.seller.SellerVerifiesPeersAccountAge;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerCreatesDelayedPayoutTx;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerCreatesDepositTxInputs;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerSignAndPublishDepositTx;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerFinalizesDelayedPayoutTx;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerProcessDelayedPayoutTxSignatureMessage;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerPublishesDepositTx;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerSendSignDelayedPayoutTxMessage;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerSignsDelayedPayoutTx;
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerSignsDepositTx;
import bisq.core.trade.protocol.tasks.taker.CreateTakerFeeTx;
import bisq.core.trade.protocol.tasks.taker.TakerProcessPublishDepositTxRequest;
import bisq.core.trade.protocol.tasks.taker.TakerProcessesProvideInputsForDepositTxMessage;
import bisq.core.trade.protocol.tasks.taker.TakerPublishFeeTx;
import bisq.core.trade.protocol.tasks.taker.TakerSendDepositTxPublishedMessage;
import bisq.core.trade.protocol.tasks.taker.TakerSendPayDepositRequest;
import bisq.core.trade.protocol.tasks.taker.TakerSendsDepositTxAndDelayedPayoutTxMessage;
import bisq.core.trade.protocol.tasks.taker.TakerVerifyAndSignContract;
import bisq.core.trade.protocol.tasks.taker.TakerVerifyMakerAccount;
import bisq.core.trade.protocol.tasks.taker.TakerVerifyMakerFeePayment;
@@ -83,8 +90,8 @@ public void doApplyMailboxMessage(NetworkEnvelope networkEnvelope, Trade trade)
TradeMessage tradeMessage = (TradeMessage) networkEnvelope;
log.info("Received {} as MailboxMessage from {} with tradeId {} and uid {}",
tradeMessage.getClass().getSimpleName(), peerNodeAddress, tradeMessage.getTradeId(), tradeMessage.getUid());
if (tradeMessage instanceof PublishDepositTxRequest)
handle((PublishDepositTxRequest) tradeMessage, peerNodeAddress);
if (tradeMessage instanceof InputsForDepositTxResponse)
handle((InputsForDepositTxResponse) tradeMessage, peerNodeAddress);
else if (tradeMessage instanceof CounterCurrencyTransferStartedMessage)
handle((CounterCurrencyTransferStartedMessage) tradeMessage, peerNodeAddress);
else
@@ -123,7 +130,7 @@ public void takeAvailableOffer() {
// Incoming message handling
///////////////////////////////////////////////////////////////////////////////////////////

private void handle(PublishDepositTxRequest tradeMessage, NodeAddress sender) {
private void handle(InputsForDepositTxResponse tradeMessage, NodeAddress sender) {
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);

@@ -135,16 +142,38 @@ private void handle(PublishDepositTxRequest tradeMessage, NodeAddress sender) {
errorMessage -> handleTaskRunnerFault(tradeMessage, errorMessage));

taskRunner.addTasks(
TakerProcessPublishDepositTxRequest.class,
TakerProcessesProvideInputsForDepositTxMessage.class,
ApplyFilter.class,
TakerVerifyMakerAccount.class,
VerifyPeersAccountAgeWitness.class,
SellerVerifiesPeersAccountAge.class,
TakerVerifyMakerFeePayment.class,
TakerVerifyAndSignContract.class,
TakerPublishFeeTx.class,
SellerAsTakerSignAndPublishDepositTx.class,
TakerSendDepositTxPublishedMessage.class,
SellerAsTakerSignsDepositTx.class,
SellerAsTakerCreatesDelayedPayoutTx.class,
SellerAsTakerSendSignDelayedPayoutTxMessage.class
);
taskRunner.run();
}

private void handle(DelayedPayoutTxSignatureResponse tradeMessage, NodeAddress sender) {
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);

TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsTakerTrade,
() -> {
stopTimeout();
handleTaskRunnerSuccess(tradeMessage, "PublishDepositTxRequest");
},
errorMessage -> handleTaskRunnerFault(tradeMessage, errorMessage));

taskRunner.addTasks(
SellerAsTakerProcessDelayedPayoutTxSignatureMessage.class,
SellerAsTakerSignsDelayedPayoutTx.class,
SellerAsTakerFinalizesDelayedPayoutTx.class,
SellerAsTakerPublishesDepositTx.class,
TakerSendsDepositTxAndDelayedPayoutTxMessage.class,
PublishTradeStatistics.class
);
taskRunner.run();
@@ -238,8 +267,10 @@ protected void doHandleDecryptedMessage(TradeMessage tradeMessage, NodeAddress s
log.info("Received {} from {} with tradeId {} and uid {}",
tradeMessage.getClass().getSimpleName(), sender, tradeMessage.getTradeId(), tradeMessage.getUid());

if (tradeMessage instanceof PublishDepositTxRequest) {
handle((PublishDepositTxRequest) tradeMessage, sender);
if (tradeMessage instanceof InputsForDepositTxResponse) {
handle((InputsForDepositTxResponse) tradeMessage, sender);
} else if (tradeMessage instanceof DelayedPayoutTxSignatureResponse) {
handle((DelayedPayoutTxSignatureResponse) tradeMessage, sender);
} else if (tradeMessage instanceof CounterCurrencyTransferStartedMessage) {
handle((CounterCurrencyTransferStartedMessage) tradeMessage, sender);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.