Refactoring: Rename all usages of "offerer" with "maker" (excluding translation strings). Separate maker, taker, buyer, seller, buyerAsTaker, BuyerAsMaker, sellerAsMaker and sellerAsTaker in protocol

This commit is contained in:
Manfred Karrer 2017-03-25 11:50:08 -05:00
parent 1bfead7a77
commit 598291540e
87 changed files with 691 additions and 663 deletions

View file

@ -17,6 +17,7 @@
package io.bisq.common.locale;
import io.bisq.common.app.DevEnv;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
@ -70,6 +71,9 @@ public class Res {
try {
return resourceBundle.getString(key);
} catch (MissingResourceException e) {
if (DevEnv.DEV_MODE)
throw new RuntimeException("Missing resource for key: " + key);
log.warn("Missing resource for key: " + key);
return key;
}

View file

@ -284,7 +284,7 @@ public class DisputeManager {
disputeFromOpener.getTradeId(),
pubKeyRing.hashCode(),
!disputeFromOpener.isDisputeOpenerIsBuyer(),
!disputeFromOpener.isDisputeOpenerIsOfferer(),
!disputeFromOpener.isDisputeOpenerIsMaker(),
pubKeyRing,
disputeFromOpener.getTradeDate(),
contractFromOpener,
@ -294,7 +294,7 @@ public class DisputeManager {
disputeFromOpener.getDepositTxId(),
disputeFromOpener.getPayoutTxId(),
disputeFromOpener.getContractAsJson(),
disputeFromOpener.getOffererContractSignature(),
disputeFromOpener.getMakerContractSignature(),
disputeFromOpener.getTakerContractSignature(),
disputeFromOpener.getArbitratorPubKeyRing(),
disputeFromOpener.isSupportTicket()

View file

@ -21,12 +21,12 @@ import io.bisq.protobuffer.payload.btc.RawTransactionInput;
import java.util.ArrayList;
public class PreparedDepositTxAndOffererInputs {
public final ArrayList<RawTransactionInput> rawOffererInputs;
public class PreparedDepositTxAndMakerInputs {
public final ArrayList<RawTransactionInput> rawMakerInputs;
public final byte[] depositTransaction;
public PreparedDepositTxAndOffererInputs(ArrayList<RawTransactionInput> rawOffererInputs, byte[] depositTransaction) {
this.rawOffererInputs = rawOffererInputs;
public PreparedDepositTxAndMakerInputs(ArrayList<RawTransactionInput> rawMakerInputs, byte[] depositTransaction) {
this.rawMakerInputs = rawMakerInputs;
this.depositTransaction = depositTransaction;
}
}

View file

@ -26,7 +26,7 @@ import io.bisq.common.app.Log;
import io.bisq.common.util.Utilities;
import io.bisq.core.btc.AddressEntry;
import io.bisq.core.btc.data.InputsAndChangeOutput;
import io.bisq.core.btc.data.PreparedDepositTxAndOffererInputs;
import io.bisq.core.btc.data.PreparedDepositTxAndMakerInputs;
import io.bisq.core.btc.exceptions.SigningException;
import io.bisq.core.btc.exceptions.TransactionVerificationException;
import io.bisq.core.btc.exceptions.WalletException;
@ -191,14 +191,14 @@ public class TradeWalletService {
///////////////////////////////////////////////////////////////////////////////////////////
// We construct the deposit transaction in the way that the buyer is always the first entry (inputs, outputs, MS keys) and then the seller.
// In the creation of the deposit tx the taker/offerer roles are the determining roles instead of buyer/seller.
// In the creation of the deposit tx the taker/maker roles are the determining roles instead of buyer/seller.
// In the payout tx is is the buyer/seller role. We keep the buyer/seller ordering over all transactions to not get confusion with ordering,
// which is important to follow correctly specially for the order of the MS keys.
/**
* The taker creates a dummy transaction to get the input(s) and optional change output for the amount and the takersAddress for that trade.
* That will be used to send to the offerer for creating the deposit transaction.
* That will be used to send to the maker for creating the deposit transaction.
*
* @param inputAmount Amount of takers input
* @param txFee Mining fee
@ -278,47 +278,47 @@ public class TradeWalletService {
}
/**
* The offerer creates the deposit transaction using the takers input(s) and optional output and signs his input(s).
* The maker creates the deposit transaction using the takers input(s) and optional output and signs his input(s).
*
* @param offererIsBuyer The flag indicating if we are in the offerer as buyer role or the opposite.
* @param makerIsBuyer The flag indicating if we are in the maker as buyer role or the opposite.
* @param contractHash The hash of the contract to be added to the OP_RETURN output.
* @param offererInputAmount The input amount of the offerer.
* @param makerInputAmount The input amount of the maker.
* @param msOutputAmount The output amount to our MS output.
* @param takerRawTransactionInputs Raw data for the connected outputs for all inputs of the taker (normally 1 input)
* @param takerChangeOutputValue Optional taker change output value
* @param takerChangeAddressString Optional taker change address
* @param offererAddress The offerer's address.
* @param offererChangeAddress The offerer's change address.
* @param makerAddress The maker's address.
* @param makerChangeAddress The maker's change address.
* @param buyerPubKey The public key of the buyer.
* @param sellerPubKey The public key of the seller.
* @param arbitratorPubKey The public key of the arbitrator.
* @return A data container holding the serialized transaction and the offerer raw inputs
* @return A data container holding the serialized transaction and the maker raw inputs
* @throws SigningException
* @throws TransactionVerificationException
* @throws WalletException
*/
public PreparedDepositTxAndOffererInputs offererCreatesAndSignsDepositTx(boolean offererIsBuyer,
byte[] contractHash,
Coin offererInputAmount,
Coin msOutputAmount,
List<RawTransactionInput> takerRawTransactionInputs,
long takerChangeOutputValue,
@Nullable String takerChangeAddressString,
Address offererAddress,
Address offererChangeAddress,
byte[] buyerPubKey,
byte[] sellerPubKey,
byte[] arbitratorPubKey)
public PreparedDepositTxAndMakerInputs makerCreatesAndSignsDepositTx(boolean makerIsBuyer,
byte[] contractHash,
Coin makerInputAmount,
Coin msOutputAmount,
List<RawTransactionInput> takerRawTransactionInputs,
long takerChangeOutputValue,
@Nullable String takerChangeAddressString,
Address makerAddress,
Address makerChangeAddress,
byte[] buyerPubKey,
byte[] sellerPubKey,
byte[] arbitratorPubKey)
throws SigningException, TransactionVerificationException, WalletException, AddressFormatException {
log.trace("offererCreatesAndSignsDepositTx called");
log.trace("offererIsBuyer " + offererIsBuyer);
log.trace("offererInputAmount " + offererInputAmount.toFriendlyString());
log.trace("makerCreatesAndSignsDepositTx called");
log.trace("makerIsBuyer " + makerIsBuyer);
log.trace("makerInputAmount " + makerInputAmount.toFriendlyString());
log.trace("msOutputAmount " + msOutputAmount.toFriendlyString());
log.trace("takerRawInputs " + takerRawTransactionInputs.toString());
log.trace("takerChangeOutputValue " + takerChangeOutputValue);
log.trace("takerChangeAddressString " + takerChangeAddressString);
log.trace("offererAddress " + offererAddress);
log.trace("offererChangeAddress " + offererChangeAddress);
log.trace("makerAddress " + makerAddress);
log.trace("makerChangeAddress " + makerChangeAddress);
log.info("buyerPubKey " + ECKey.fromPublicOnly(buyerPubKey).toString());
log.info("sellerPubKey " + ECKey.fromPublicOnly(sellerPubKey).toString());
log.info("arbitratorPubKey " + ECKey.fromPublicOnly(arbitratorPubKey).toString());
@ -328,29 +328,29 @@ public class TradeWalletService {
// First we construct a dummy TX to get the inputs and outputs we want to use for the real deposit tx.
// Similar to the way we did in the createTakerDepositTxInputs method.
Transaction dummyTx = new Transaction(params);
TransactionOutput dummyOutput = new TransactionOutput(params, dummyTx, offererInputAmount, new ECKey().toAddress(params));
TransactionOutput dummyOutput = new TransactionOutput(params, dummyTx, makerInputAmount, new ECKey().toAddress(params));
dummyTx.addOutput(dummyOutput);
addAvailableInputsAndChangeOutputs(dummyTx, offererAddress, offererChangeAddress, Coin.ZERO);
addAvailableInputsAndChangeOutputs(dummyTx, makerAddress, makerChangeAddress, Coin.ZERO);
// Normally we have only 1 input but we support multiple inputs if the user has paid in with several transactions.
List<TransactionInput> offererInputs = dummyTx.getInputs();
TransactionOutput offererOutput = null;
List<TransactionInput> makerInputs = dummyTx.getInputs();
TransactionOutput makerOutput = null;
// We don't support more then 1 optional change output
Preconditions.checkArgument(dummyTx.getOutputs().size() < 3, "dummyTx.getOutputs().size() >= 3");
// Only save change outputs, the dummy output is ignored (that's why we start with index 1)
if (dummyTx.getOutputs().size() > 1)
offererOutput = dummyTx.getOutput(1);
makerOutput = dummyTx.getOutput(1);
// Now we construct the real deposit tx
Transaction preparedDepositTx = new Transaction(params);
ArrayList<RawTransactionInput> offererRawTransactionInputs = new ArrayList<>();
if (offererIsBuyer) {
ArrayList<RawTransactionInput> makerRawTransactionInputs = new ArrayList<>();
if (makerIsBuyer) {
// Add buyer inputs
for (TransactionInput input : offererInputs) {
for (TransactionInput input : makerInputs) {
preparedDepositTx.addInput(input);
offererRawTransactionInputs.add(getRawInputFromTransactionInput(input));
makerRawTransactionInputs.add(getRawInputFromTransactionInput(input));
}
// Add seller inputs
@ -366,9 +366,9 @@ public class TradeWalletService {
preparedDepositTx.addInput(getTransactionInput(preparedDepositTx, new byte[]{}, rawTransactionInput));
// Add seller inputs
for (TransactionInput input : offererInputs) {
for (TransactionInput input : makerInputs) {
preparedDepositTx.addInput(input);
offererRawTransactionInputs.add(getRawInputFromTransactionInput(input));
makerRawTransactionInputs.add(getRawInputFromTransactionInput(input));
}
}
@ -390,10 +390,10 @@ public class TradeWalletService {
takerTransactionOutput = new TransactionOutput(params, preparedDepositTx, Coin.valueOf(takerChangeOutputValue),
new Address(params, takerChangeAddressString));
if (offererIsBuyer) {
if (makerIsBuyer) {
// Add optional buyer outputs
if (offererOutput != null)
preparedDepositTx.addOutput(offererOutput);
if (makerOutput != null)
preparedDepositTx.addOutput(makerOutput);
// Add optional seller outputs
if (takerTransactionOutput != null)
@ -406,13 +406,13 @@ public class TradeWalletService {
preparedDepositTx.addOutput(takerTransactionOutput);
// Add optional buyer outputs
if (offererOutput != null)
preparedDepositTx.addOutput(offererOutput);
if (makerOutput != null)
preparedDepositTx.addOutput(makerOutput);
}
// Sign inputs
int start = offererIsBuyer ? 0 : takerRawTransactionInputs.size();
int end = offererIsBuyer ? offererInputs.size() : preparedDepositTx.getInputs().size();
int start = makerIsBuyer ? 0 : takerRawTransactionInputs.size();
int end = makerIsBuyer ? makerInputs.size() : preparedDepositTx.getInputs().size();
for (int i = start; i < end; i++) {
TransactionInput input = preparedDepositTx.getInput(i);
signInput(preparedDepositTx, input, i);
@ -423,15 +423,15 @@ public class TradeWalletService {
verifyTransaction(preparedDepositTx);
return new PreparedDepositTxAndOffererInputs(offererRawTransactionInputs, preparedDepositTx.bitcoinSerialize());
return new PreparedDepositTxAndMakerInputs(makerRawTransactionInputs, preparedDepositTx.bitcoinSerialize());
}
/**
* The taker signs the deposit transaction he received from the offerer and publishes it.
* The taker signs the deposit transaction he received from the maker and publishes it.
*
* @param takerIsSeller The flag indicating if we are in the taker as seller role or the opposite.
* @param contractHash The hash of the contract to be added to the OP_RETURN output.
* @param offerersDepositTxSerialized The prepared deposit transaction signed by the offerer.
* @param makersDepositTxSerialized The prepared deposit transaction signed by the maker.
* @param buyerInputs The connected outputs for all inputs of the buyer.
* @param sellerInputs The connected outputs for all inputs of the seller.
* @param buyerPubKey The public key of the buyer.
@ -444,7 +444,7 @@ public class TradeWalletService {
*/
public Transaction takerSignsAndPublishesDepositTx(boolean takerIsSeller,
byte[] contractHash,
byte[] offerersDepositTxSerialized,
byte[] makersDepositTxSerialized,
List<RawTransactionInput> buyerInputs,
List<RawTransactionInput> sellerInputs,
byte[] buyerPubKey,
@ -452,11 +452,11 @@ public class TradeWalletService {
byte[] arbitratorPubKey,
FutureCallback<Transaction> callback) throws SigningException, TransactionVerificationException,
WalletException {
Transaction offerersDepositTx = new Transaction(params, offerersDepositTxSerialized);
Transaction makersDepositTx = new Transaction(params, makersDepositTxSerialized);
log.trace("signAndPublishDepositTx called");
log.trace("takerIsSeller " + takerIsSeller);
log.trace("offerersDepositTx " + offerersDepositTx.toString());
log.trace("makersDepositTx " + makersDepositTx.toString());
log.trace("buyerConnectedOutputsForAllInputs " + buyerInputs.toString());
log.trace("sellerConnectedOutputsForAllInputs " + sellerInputs.toString());
log.info("buyerPubKey " + ECKey.fromPublicOnly(buyerPubKey).toString());
@ -466,20 +466,20 @@ public class TradeWalletService {
checkArgument(!buyerInputs.isEmpty());
checkArgument(!sellerInputs.isEmpty());
// Check if offerer's Multisig script is identical to the takers
// Check if maker's Multisig script is identical to the takers
Script p2SHMultiSigOutputScript = getP2SHMultiSigOutputScript(buyerPubKey, sellerPubKey, arbitratorPubKey);
if (!offerersDepositTx.getOutput(0).getScriptPubKey().equals(p2SHMultiSigOutputScript))
throw new TransactionVerificationException("Offerer's p2SHMultiSigOutputScript does not match to takers p2SHMultiSigOutputScript");
if (!makersDepositTx.getOutput(0).getScriptPubKey().equals(p2SHMultiSigOutputScript))
throw new TransactionVerificationException("Maker's p2SHMultiSigOutputScript does not match to takers p2SHMultiSigOutputScript");
// The outpoints are not available from the serialized offerersDepositTx, so we cannot use that tx directly, but we use it to construct a new
// The outpoints are not available from the serialized makersDepositTx, so we cannot use that tx directly, but we use it to construct a new
// depositTx
Transaction depositTx = new Transaction(params);
if (takerIsSeller) {
// Add buyer inputs and apply signature
// We grab the signature from the offerersDepositTx and apply it to the new tx input
// We grab the signature from the makersDepositTx and apply it to the new tx input
for (int i = 0; i < buyerInputs.size(); i++)
depositTx.addInput(getTransactionInput(depositTx, getScriptProgram(offerersDepositTx, i), buyerInputs.get(i)));
depositTx.addInput(getTransactionInput(depositTx, getScriptProgram(makersDepositTx, i), buyerInputs.get(i)));
// Add seller inputs
for (RawTransactionInput rawTransactionInput : sellerInputs)
@ -491,23 +491,23 @@ public class TradeWalletService {
depositTx.addInput(getTransactionInput(depositTx, new byte[]{}, rawTransactionInput));
// Add seller inputs
// We grab the signature from the offerersDepositTx and apply it to the new tx input
for (int i = buyerInputs.size(), k = 0; i < offerersDepositTx.getInputs().size(); i++, k++)
depositTx.addInput(getTransactionInput(depositTx, getScriptProgram(offerersDepositTx, i), sellerInputs.get(k)));
// We grab the signature from the makersDepositTx and apply it to the new tx input
for (int i = buyerInputs.size(), k = 0; i < makersDepositTx.getInputs().size(); i++, k++)
depositTx.addInput(getTransactionInput(depositTx, getScriptProgram(makersDepositTx, i), sellerInputs.get(k)));
}
// Check if OP_RETURN output with contract hash matches the one from the offerer
TransactionOutput contractHashOutput = new TransactionOutput(params, offerersDepositTx, Coin.ZERO,
// Check if OP_RETURN output with contract hash matches the one from the maker
TransactionOutput contractHashOutput = new TransactionOutput(params, makersDepositTx, Coin.ZERO,
ScriptBuilder.createOpReturnScript(contractHash).getProgram());
log.debug("contractHashOutput " + contractHashOutput);
TransactionOutput offerersContractHashOutput = offerersDepositTx.getOutputs().get(1);
log.debug("offerersContractHashOutput " + offerersContractHashOutput);
if (!offerersContractHashOutput.getScriptPubKey().equals(contractHashOutput.getScriptPubKey()))
throw new TransactionVerificationException("Offerer's transaction output for the contract hash is not matching takers version.");
TransactionOutput makersContractHashOutput = makersDepositTx.getOutputs().get(1);
log.debug("makersContractHashOutput " + makersContractHashOutput);
if (!makersContractHashOutput.getScriptPubKey().equals(contractHashOutput.getScriptPubKey()))
throw new TransactionVerificationException("Maker's transaction output for the contract hash is not matching takers version.");
// Add all outputs from offerersDepositTx to depositTx
offerersDepositTx.getOutputs().forEach(depositTx::addOutput);
//BtcWalletService.printTx("offerersDepositTx", offerersDepositTx);
// Add all outputs from makersDepositTx to depositTx
makersDepositTx.getOutputs().forEach(depositTx::addOutput);
//BtcWalletService.printTx("makersDepositTx", makersDepositTx);
// Sign inputs
int start = takerIsSeller ? buyerInputs.size() : 0;
@ -1170,10 +1170,10 @@ public class TradeWalletService {
return new RawTransactionInput(input.getOutpoint().getIndex(), input.getConnectedOutput().getParentTransaction().bitcoinSerialize(), input.getValue().value);
}
private byte[] getScriptProgram(Transaction offerersDepositTx, int i) throws TransactionVerificationException {
byte[] scriptProgram = offerersDepositTx.getInputs().get(i).getScriptSig().getProgram();
private byte[] getScriptProgram(Transaction makersDepositTx, int i) throws TransactionVerificationException {
byte[] scriptProgram = makersDepositTx.getInputs().get(i).getScriptSig().getProgram();
if (scriptProgram.length == 0)
throw new TransactionVerificationException("Inputs from offerer not signed.");
throw new TransactionVerificationException("Inputs from maker not signed.");
return scriptProgram;
}

View file

@ -52,7 +52,7 @@ public class Offer implements Serializable {
AVAILABLE,
NOT_AVAILABLE,
REMOVED,
OFFERER_OFFLINE
MAKER_OFFLINE
}
@ -180,7 +180,7 @@ public class Offer implements Serializable {
double factor = (double) takersTradePrice / (double) offerPrice.getValue();
// We allow max. 1 % difference between own offerPayload price calculation and takers calculation.
// Market price might be different at offerer's and takers side so we need a bit of tolerance.
// Market price might be different at maker's and takers side so we need a bit of tolerance.
// The tolerance will get smaller once we have multiple price feeds avoiding fast price fluctuations
// from one provider.
if (Math.abs(1 - factor) > 0.01) {
@ -367,16 +367,16 @@ public class Offer implements Serializable {
return offerPayload.getMarketPriceMargin();
}
public NodeAddress getOffererNodeAddress() {
return offerPayload.getOffererNodeAddress();
public NodeAddress getMakerNodeAddress() {
return offerPayload.getMakerNodeAddress();
}
public PubKeyRing getPubKeyRing() {
return offerPayload.getPubKeyRing();
}
public String getOffererPaymentAccountId() {
return offerPayload.getOffererPaymentAccountId();
public String getMakerPaymentAccountId() {
return offerPayload.getMakerPaymentAccountId();
}
public String getOfferFeePaymentTxId() {

View file

@ -368,7 +368,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
if (openOfferOptional.isPresent()) {
if (openOfferOptional.get().getState() == OpenOffer.State.AVAILABLE) {
final Offer offer = openOfferOptional.get().getOffer();
if (!preferences.getIgnoreTradersList().stream().filter(i -> i.equals(offer.getOffererNodeAddress().getHostNameWithoutPostFix())).findAny().isPresent()) {
if (!preferences.getIgnoreTradersList().stream().filter(i -> i.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix())).findAny().isPresent()) {
availabilityResult = AvailabilityResult.AVAILABLE;
List<NodeAddress> acceptedArbitrators = user.getAcceptedArbitratorAddresses();
if (acceptedArbitrators != null && !acceptedArbitrators.isEmpty()) {

View file

@ -85,7 +85,7 @@ public class OfferAvailabilityProtocol {
model.offer.setState(Offer.State.UNDEFINED);
model.p2PService.addDecryptedDirectMessageListener(decryptedDirectMessageListener);
model.setPeerNodeAddress(model.offer.getOffererNodeAddress());
model.setPeerNodeAddress(model.offer.getMakerNodeAddress());
taskRunner = new TaskRunner<>(model,
() -> log.debug("sequence at sendOfferAvailabilityRequest completed"),
@ -135,7 +135,7 @@ public class OfferAvailabilityProtocol {
if (timeoutTimer == null) {
timeoutTimer = UserThread.runAfter(() -> {
log.debug("Timeout reached at " + this);
model.offer.setState(Offer.State.OFFERER_OFFLINE);
model.offer.setState(Offer.State.MAKER_OFFLINE);
errorMessageHandler.handleErrorMessage("Timeout reached: Peer has not responded.");
}, TIMEOUT_SEC);
} else {

View file

@ -49,7 +49,7 @@ public class SendOfferAvailabilityRequest extends Task<OfferAvailabilityModel> {
@Override
public void onFault() {
model.offer.setState(Offer.State.OFFERER_OFFLINE);
model.offer.setState(Offer.State.MAKER_OFFLINE);
}
}
);

View file

@ -20,8 +20,8 @@ package io.bisq.core.trade;
import io.bisq.common.app.Version;
import io.bisq.common.storage.Storage;
import io.bisq.core.offer.Offer;
import io.bisq.core.trade.protocol.BuyerAsOffererProtocol;
import io.bisq.core.trade.protocol.OffererProtocol;
import io.bisq.core.trade.protocol.BuyerAsMakerProtocol;
import io.bisq.core.trade.protocol.MakerProtocol;
import io.bisq.protobuffer.message.trade.TradeMessage;
import io.bisq.protobuffer.payload.p2p.NodeAddress;
import org.bitcoinj.core.Coin;
@ -31,18 +31,18 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.ObjectInputStream;
public final class BuyerAsOffererTrade extends BuyerTrade implements OffererTrade {
public final class BuyerAsMakerTrade extends BuyerTrade implements MakerTrade {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
private static final Logger log = LoggerFactory.getLogger(BuyerAsMakerTrade.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor, initialization
///////////////////////////////////////////////////////////////////////////////////////////
public BuyerAsOffererTrade(Offer offer, Coin txFee, Coin takeOfferFee, Storage<? extends TradableList> storage) {
public BuyerAsMakerTrade(Offer offer, Coin txFee, Coin takeOfferFee, Storage<? extends TradableList> storage) {
super(offer, txFee, takeOfferFee, storage);
}
@ -58,7 +58,7 @@ public final class BuyerAsOffererTrade extends BuyerTrade implements OffererTrad
@Override
protected void createProtocol() {
tradeProtocol = new BuyerAsOffererProtocol(this);
tradeProtocol = new BuyerAsMakerProtocol(this);
}
@ -68,6 +68,6 @@ public final class BuyerAsOffererTrade extends BuyerTrade implements OffererTrad
@Override
public void handleTakeOfferRequest(TradeMessage message, NodeAddress taker) {
((OffererProtocol) tradeProtocol).handleTakeOfferRequest(message, taker);
((MakerProtocol) tradeProtocol).handleTakeOfferRequest(message, taker);
}
}

View file

@ -35,7 +35,7 @@ public abstract class BuyerTrade extends Trade {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
private static final Logger log = LoggerFactory.getLogger(BuyerAsOffererTrade.class);
private static final Logger log = LoggerFactory.getLogger(BuyerAsMakerTrade.class);
BuyerTrade(Offer offer, Coin tradeAmount, Coin txFee, Coin takeOfferFee, long tradePrice, NodeAddress tradingPeerNodeAddress, Storage<? extends TradableList> storage) {
super(offer, tradeAmount, txFee, takeOfferFee, tradePrice, tradingPeerNodeAddress, storage);

View file

@ -21,6 +21,6 @@ package io.bisq.core.trade;
import io.bisq.protobuffer.message.trade.TradeMessage;
import io.bisq.protobuffer.payload.p2p.NodeAddress;
public interface OffererTrade {
public interface MakerTrade {
void handleTakeOfferRequest(TradeMessage message, NodeAddress peerNodeAddress);
}

View file

@ -20,8 +20,8 @@ package io.bisq.core.trade;
import io.bisq.common.app.Version;
import io.bisq.common.storage.Storage;
import io.bisq.core.offer.Offer;
import io.bisq.core.trade.protocol.OffererProtocol;
import io.bisq.core.trade.protocol.SellerAsOffererProtocol;
import io.bisq.core.trade.protocol.MakerProtocol;
import io.bisq.core.trade.protocol.SellerAsMakerProtocol;
import io.bisq.protobuffer.message.trade.TradeMessage;
import io.bisq.protobuffer.payload.p2p.NodeAddress;
import org.bitcoinj.core.Coin;
@ -31,18 +31,18 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.ObjectInputStream;
public final class SellerAsOffererTrade extends SellerTrade implements OffererTrade {
public final class SellerAsMakerTrade extends SellerTrade implements MakerTrade {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
private static final Logger log = LoggerFactory.getLogger(SellerAsOffererTrade.class);
private static final Logger log = LoggerFactory.getLogger(SellerAsMakerTrade.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor, initialization
///////////////////////////////////////////////////////////////////////////////////////////
public SellerAsOffererTrade(Offer offer, Coin txFee, Coin takeOfferFee, Storage<? extends TradableList> storage) {
public SellerAsMakerTrade(Offer offer, Coin txFee, Coin takeOfferFee, Storage<? extends TradableList> storage) {
super(offer, txFee, takeOfferFee, storage);
}
@ -58,7 +58,7 @@ public final class SellerAsOffererTrade extends SellerTrade implements OffererTr
@Override
protected void createProtocol() {
tradeProtocol = new SellerAsOffererProtocol(this);
tradeProtocol = new SellerAsMakerProtocol(this);
}
@ -68,6 +68,6 @@ public final class SellerAsOffererTrade extends SellerTrade implements OffererTr
@Override
public void handleTakeOfferRequest(TradeMessage message, NodeAddress taker) {
((OffererProtocol) tradeProtocol).handleTakeOfferRequest(message, taker);
((MakerProtocol) tradeProtocol).handleTakeOfferRequest(message, taker);
}
}

View file

@ -74,11 +74,11 @@ public abstract class Trade implements Tradable, Model {
TAKER_FEE_PAID(Phase.TAKER_FEE_PAID),
OFFERER_SENT_PUBLISH_DEPOSIT_TX_REQUEST(Phase.DEPOSIT_REQUESTED),
MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST(Phase.DEPOSIT_REQUESTED),
TAKER_PUBLISHED_DEPOSIT_TX(Phase.DEPOSIT_PAID),
DEPOSIT_SEEN_IN_NETWORK(Phase.DEPOSIT_PAID), // triggered by balance update, used only in error cases
TAKER_SENT_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PAID),
OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PAID),
MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG(Phase.DEPOSIT_PAID),
DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN(Phase.DEPOSIT_PAID),
BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED(Phase.FIAT_SENT),
@ -86,7 +86,7 @@ public abstract class Trade implements Tradable, Model {
SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG(Phase.FIAT_SENT),
SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT(Phase.FIAT_RECEIVED),
SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG(Phase.FIAT_RECEIVED),
SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG(Phase.FIAT_RECEIVED),
BUYER_RECEIVED_FIAT_PAYMENT_RECEIPT_MSG(Phase.FIAT_RECEIVED),
SELLER_COMMITTED_PAYOUT_TX(Phase.PAYOUT_PAID), //new TODO needed?
@ -177,7 +177,7 @@ public abstract class Trade implements Tradable, Model {
private String contractAsJson;
private byte[] contractHash;
private String takerContractSignature;
private String offererContractSignature;
private String makerContractSignature;
private Transaction payoutTx;
//TODO: locktime
// private long lockTimeAsBlockHeight;
@ -195,7 +195,7 @@ public abstract class Trade implements Tradable, Model {
// Constructor, initialization
///////////////////////////////////////////////////////////////////////////////////////////
// offerer
// maker
protected Trade(Offer offer, Coin txFee, Coin takeOfferFee, Storage<? extends TradableList> storage) {
this.offer = offer;
this.txFee = txFee;
@ -532,13 +532,13 @@ public abstract class Trade implements Tradable, Model {
return takerContractSignature;
}
public void setOffererContractSignature(String offererContractSignature) {
this.offererContractSignature = offererContractSignature;
public void setMakerContractSignature(String makerContractSignature) {
this.makerContractSignature = makerContractSignature;
}
@Nullable
public String getOffererContractSignature() {
return offererContractSignature;
public String getMakerContractSignature() {
return makerContractSignature;
}
public void setContractAsJson(String contractAsJson) {
@ -692,8 +692,8 @@ public abstract class Trade implements Tradable, Model {
"\n\tcontract=" + contract +
"\n\ttakerContractSignature.hashCode()='" + (takerContractSignature != null ?
takerContractSignature.hashCode() : "") + '\'' +
"\n\toffererContractSignature.hashCode()='" + (offererContractSignature != null ?
offererContractSignature.hashCode() : "") + '\'' +
"\n\tmakerContractSignature.hashCode()='" + (makerContractSignature != null ?
makerContractSignature.hashCode() : "") + '\'' +
"\n\tpayoutTx=" + payoutTx +
/* "\n\tlockTimeAsBlockHeight=" + lockTimeAsBlockHeight +*/
"\n\tarbitratorNodeAddress=" + arbitratorNodeAddress +

View file

@ -269,16 +269,16 @@ public class TradeManager {
PayDepositRequest payDepositRequest = (PayDepositRequest) message;
Trade trade;
if (offer.isBuyOffer())
trade = new BuyerAsOffererTrade(offer, Coin.valueOf(payDepositRequest.txFee),
trade = new BuyerAsMakerTrade(offer, Coin.valueOf(payDepositRequest.txFee),
Coin.valueOf(payDepositRequest.takeOfferFee), tradableListStorage);
else
trade = new SellerAsOffererTrade(offer, Coin.valueOf(payDepositRequest.txFee),
trade = new SellerAsMakerTrade(offer, Coin.valueOf(payDepositRequest.txFee),
Coin.valueOf(payDepositRequest.takeOfferFee), tradableListStorage);
trade.setStorage(tradableListStorage);
initTrade(trade, trade.getProcessModel().getUseSavingsWallet(), trade.getProcessModel().getFundsNeededForTrade());
trades.add(trade);
((OffererTrade) trade).handleTakeOfferRequest(message, peerNodeAddress);
((MakerTrade) trade).handleTakeOfferRequest(message, peerNodeAddress);
} else {
// TODO respond
//(RequestDepositTxInputsMessage)message.
@ -467,7 +467,7 @@ public class TradeManager {
}
public boolean isBuyer(Offer offer) {
// If I am the offerer, we use the offer direction, otherwise the mirrored direction
// If I am the maker, we use the offer direction, otherwise the mirrored direction
if (isMyOffer(offer))
return offer.isBuyOffer();
else

View file

@ -19,10 +19,15 @@ package io.bisq.core.trade.protocol;
import io.bisq.common.handlers.ErrorMessageHandler;
import io.bisq.common.handlers.ResultHandler;
import io.bisq.core.trade.BuyerAsOffererTrade;
import io.bisq.core.trade.BuyerAsMakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.buyer.*;
import io.bisq.core.trade.protocol.tasks.offerer.*;
import io.bisq.core.trade.protocol.tasks.buyer.BuyerSendFiatTransferStartedMessage;
import io.bisq.core.trade.protocol.tasks.buyer.BuyerSetupListenerForPayoutTx;
import io.bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerCreatesAndSignsDepositTx;
import io.bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerMightBroadcastPayoutTx;
import io.bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerProcessPayoutTxPublishedMessage;
import io.bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerSignPayoutTx;
import io.bisq.core.trade.protocol.tasks.maker.*;
import io.bisq.core.util.Validator;
import io.bisq.protobuffer.message.Message;
import io.bisq.protobuffer.message.p2p.MailboxMessage;
@ -36,18 +41,18 @@ import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j
public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtocol, OffererProtocol {
private final BuyerAsOffererTrade buyerAsOffererTrade;
public class BuyerAsMakerProtocol extends TradeProtocol implements BuyerProtocol, MakerProtocol {
private final BuyerAsMakerTrade buyerAsMakerTrade;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public BuyerAsOffererProtocol(BuyerAsOffererTrade trade) {
public BuyerAsMakerProtocol(BuyerAsMakerTrade trade) {
super(trade);
this.buyerAsOffererTrade = trade;
this.buyerAsMakerTrade = trade;
Trade.State tradeState = trade.getState();
Trade.Phase phase = tradeState.getPhase();
@ -57,12 +62,12 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
tradeState != Trade.State.PAYOUT_BROAD_CASTED) {
TradeTaskRunner taskRunner = new TradeTaskRunner(trade,
() -> {
handleTaskRunnerSuccess("BuyerAsOffererMightBroadcastPayoutTx");
handleTaskRunnerSuccess("BuyerAsMakerMightBroadcastPayoutTx");
processModel.onComplete();
},
this::handleTaskRunnerFault);
taskRunner.addTasks(BuyerAsOffererMightBroadcastPayoutTx.class);
taskRunner.addTasks(BuyerAsMakerMightBroadcastPayoutTx.class);
taskRunner.run();
} else if (trade.getPayoutTx() == null && tradeState == Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG
&& phase != Trade.Phase.PAYOUT_PAID) {
@ -74,7 +79,7 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
},
this::handleTaskRunnerFault);
taskRunner.addTasks(SetupListenerForPayoutTx.class);
taskRunner.addTasks(BuyerSetupListenerForPayoutTx.class);
taskRunner.run();
}
}
@ -112,19 +117,19 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
processModel.setTradeMessage(message);
processModel.setTempTradingPeerNodeAddress(peerNodeAddress);
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade,
() -> handleTaskRunnerSuccess("handleTakeOfferRequest"),
this::handleTaskRunnerFault);
taskRunner.addTasks(
ProcessPayDepositRequest.class,
VerifyArbitrationSelection.class,
VerifyTakerFeePayment.class,
VerifyTakerAccount.class,
LoadTakeOfferFeeTx.class,
CreateAndSignContract.class,
OffererAsBuyerCreatesAndSignsDepositTx.class,
SetupDepositBalanceListener.class,
SendPublishDepositTxRequest.class
MakerProcessPayDepositRequest.class,
MakerVerifyArbitrationSelection.class,
MakerVerifyTakerFeePayment.class,
MakerVerifyTakerAccount.class,
MakerLoadTakeOfferFeeTx.class,
MakerCreateAndSignContract.class,
BuyerAsMakerCreatesAndSignsDepositTx.class,
MakerSetupDepositBalanceListener.class,
MakerSendPublishDepositTxRequest.class
);
startTimeout();
taskRunner.run();
@ -140,13 +145,13 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(peerNodeAddress);
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade,
() -> handleTaskRunnerSuccess("handle DepositTxPublishedMessage"),
this::handleTaskRunnerFault);
taskRunner.addTasks(ProcessDepositTxPublishedMessage.class,
VerifyTakerFeePayment.class,
VerifyTakerAccount.class,
PublishTradeStatistics.class);
taskRunner.addTasks(MakerProcessDepositTxPublishedMessage.class,
MakerVerifyTakerFeePayment.class,
MakerVerifyTakerAccount.class,
MakerPublishTradeStatistics.class);
taskRunner.run();
}
@ -158,14 +163,14 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
// User clicked the "bank transfer started" button
@Override
public void onFiatPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
if (buyerAsOffererTrade.getState().ordinal() <= Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG.ordinal()) {
if (buyerAsOffererTrade.getState() == Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG)
if (buyerAsMakerTrade.getState().ordinal() <= Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG.ordinal()) {
if (buyerAsMakerTrade.getState() == Trade.State.BUYER_SENT_FIAT_PAYMENT_INITIATED_MSG)
log.warn("onFiatPaymentStarted called twice. " +
"That is expected if the app starts up and the other peer has still not continued.");
buyerAsOffererTrade.setState(Trade.State.BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED);
buyerAsMakerTrade.setState(Trade.State.BUYER_CONFIRMED_FIAT_PAYMENT_INITIATED);
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade,
() -> {
resultHandler.handleResult();
handleTaskRunnerSuccess("onFiatPaymentStarted");
@ -175,17 +180,17 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
handleTaskRunnerFault(errorMessage);
});
taskRunner.addTasks(
VerifyTakerFeePayment.class,
VerifyTakerAccount.class,
BuyerAsOffererSignPayoutTx.class,
SendFiatTransferStartedMessage.class,
SetupListenerForPayoutTx.class
MakerVerifyTakerFeePayment.class,
MakerVerifyTakerAccount.class,
BuyerAsMakerSignPayoutTx.class,
BuyerSendFiatTransferStartedMessage.class,
BuyerSetupListenerForPayoutTx.class
);
taskRunner.run();
} else {
log.warn("onFiatPaymentStarted called twice. " +
"That should not happen.\n" +
"state=" + buyerAsOffererTrade.getState());
"state=" + buyerAsMakerTrade.getState());
}
}
@ -199,7 +204,7 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(peerNodeAddress);
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(buyerAsMakerTrade,
() -> {
handleTaskRunnerSuccess("handle FinalizePayoutTxRequest");
processModel.onComplete();
@ -207,8 +212,8 @@ public class BuyerAsOffererProtocol extends TradeProtocol implements BuyerProtoc
this::handleTaskRunnerFault);
taskRunner.addTasks(
BuyerProcessPayoutTxPublishedMessage.class,
BuyerAsOffererMightBroadcastPayoutTx.class
BuyerAsMakerProcessPayoutTxPublishedMessage.class,
BuyerAsMakerMightBroadcastPayoutTx.class
);
taskRunner.run();
}

View file

@ -22,7 +22,12 @@ import io.bisq.common.handlers.ErrorMessageHandler;
import io.bisq.common.handlers.ResultHandler;
import io.bisq.core.trade.BuyerAsTakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.buyer.*;
import io.bisq.core.trade.protocol.tasks.buyer.BuyerSendFiatTransferStartedMessage;
import io.bisq.core.trade.protocol.tasks.buyer.ProcessFinalizePayoutTxRequest;
import io.bisq.core.trade.protocol.tasks.buyer.SendPayoutTxFinalizedMessage;
import io.bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerCreatesDepositTxInputs;
import io.bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerSignAndFinalizePayoutTx;
import io.bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerSignAndPublishDepositTx;
import io.bisq.core.trade.protocol.tasks.shared.BroadcastPayoutTx;
import io.bisq.core.trade.protocol.tasks.taker.*;
import io.bisq.protobuffer.message.Message;
@ -95,12 +100,12 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol
this::handleTaskRunnerFault);
taskRunner.addTasks(
SelectArbitrator.class,
LoadCreateOfferFeeTx.class,
CreateTakeOfferFeeTx.class,
BroadcastTakeOfferFeeTx.class,
TakerCreatesDepositTxInputsAsBuyer.class,
SendPayDepositRequest.class
TakerSelectArbitrator.class,
TakerLoadMakerFeeTx.class,
TakerCreateTakerFeeTx.class,
TakerBroadcastTakerFeeTx.class,
BuyerAsTakerCreatesDepositTxInputs.class,
TakerSendPayDepositRequest.class
);
startTimeout();
taskRunner.run();
@ -120,13 +125,13 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol
() -> handleTaskRunnerSuccess("PublishDepositTxRequest"),
this::handleTaskRunnerFault);
taskRunner.addTasks(
ProcessPublishDepositTxRequest.class,
VerifyMakerAccount.class,
VerifyMakerFeePayment.class,
VerifyAndSignContract.class,
TakerProcessPublishDepositTxRequest.class,
TakerVerifyMakerAccount.class,
TakerVerifyMakerFeePayment.class,
TakerVerifyAndSignContract.class,
BuyerAsTakerSignAndPublishDepositTx.class,
SendDepositTxPublishedMessage.class,
PublishTradeStatistics.class
TakerSendDepositTxPublishedMessage.class,
TakerPublishTradeStatistics.class
);
taskRunner.run();
}
@ -156,9 +161,9 @@ public class BuyerAsTakerProtocol extends TradeProtocol implements BuyerProtocol
handleTaskRunnerFault(errorMessage);
});
taskRunner.addTasks(
VerifyMakerAccount.class,
VerifyMakerFeePayment.class,
SendFiatTransferStartedMessage.class
TakerVerifyMakerAccount.class,
TakerVerifyMakerFeePayment.class,
BuyerSendFiatTransferStartedMessage.class
);
taskRunner.run();
} else {

View file

@ -21,6 +21,6 @@ package io.bisq.core.trade.protocol;
import io.bisq.protobuffer.message.trade.TradeMessage;
import io.bisq.protobuffer.payload.p2p.NodeAddress;
public interface OffererProtocol {
public interface MakerProtocol {
void handleTakeOfferRequest(TradeMessage message, NodeAddress taker);
}

View file

@ -27,7 +27,7 @@ import io.bisq.core.filter.FilterManager;
import io.bisq.core.offer.Offer;
import io.bisq.core.offer.OpenOfferManager;
import io.bisq.core.payment.PaymentAccount;
import io.bisq.core.trade.OffererTrade;
import io.bisq.core.trade.MakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.TradeManager;
import io.bisq.core.user.User;
@ -187,8 +187,8 @@ public class ProcessModel implements Model, Serializable {
@Nullable
public PaymentAccountPayload getPaymentAccountPayload(Trade trade) {
PaymentAccount paymentAccount;
if (trade instanceof OffererTrade)
paymentAccount = user.getPaymentAccount(offer.getOffererPaymentAccountId());
if (trade instanceof MakerTrade)
paymentAccount = user.getPaymentAccount(offer.getMakerPaymentAccountId());
else
paymentAccount = user.getPaymentAccount(trade.getTakerPaymentAccountId());
return paymentAccount != null ? paymentAccount.getPaymentAccountPayload() : null;

View file

@ -20,10 +20,14 @@ package io.bisq.core.trade.protocol;
import io.bisq.common.handlers.ErrorMessageHandler;
import io.bisq.common.handlers.ResultHandler;
import io.bisq.core.trade.SellerAsOffererTrade;
import io.bisq.core.trade.SellerAsMakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.offerer.*;
import io.bisq.core.trade.protocol.tasks.seller.*;
import io.bisq.core.trade.protocol.tasks.maker.*;
import io.bisq.core.trade.protocol.tasks.seller.SellerProcessFiatTransferStartedMessage;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerCreatesAndSignsDepositTx;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerProcessPayoutTxFinalizedMessage;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerSendFinalizePayoutTxRequest;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerSignPayoutTx;
import io.bisq.core.trade.protocol.tasks.shared.BroadcastPayoutTx;
import io.bisq.core.util.Validator;
import io.bisq.protobuffer.message.Message;
@ -35,18 +39,18 @@ import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j
public class SellerAsOffererProtocol extends TradeProtocol implements SellerProtocol, OffererProtocol {
private final SellerAsOffererTrade sellerAsOffererTrade;
public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtocol, MakerProtocol {
private final SellerAsMakerTrade sellerAsMakerTrade;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public SellerAsOffererProtocol(SellerAsOffererTrade trade) {
public SellerAsMakerProtocol(SellerAsMakerTrade trade) {
super(trade);
this.sellerAsOffererTrade = trade;
this.sellerAsMakerTrade = trade;
// If we are after the time lock state we need to setup the listener again
//TODO not sure if that is not called already from the checkPayoutTxTimeLock at tradeProtocol
@ -100,20 +104,20 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
processModel.setTradeMessage(message);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
() -> handleTaskRunnerSuccess("handleTakeOfferRequest"),
this::handleTaskRunnerFault);
taskRunner.addTasks(
ProcessPayDepositRequest.class,
VerifyArbitrationSelection.class,
VerifyTakerAccount.class,
VerifyTakerFeePayment.class,
LoadTakeOfferFeeTx.class,
CreateAndSignContract.class,
OffererAsSelleCreatesAndSignsDepositTx.class,
SetupDepositBalanceListener.class,
SendPublishDepositTxRequest.class
MakerProcessPayDepositRequest.class,
MakerVerifyArbitrationSelection.class,
MakerVerifyTakerAccount.class,
MakerVerifyTakerFeePayment.class,
MakerLoadTakeOfferFeeTx.class,
MakerCreateAndSignContract.class,
SellerAsMakerCreatesAndSignsDepositTx.class,
MakerSetupDepositBalanceListener.class,
MakerSendPublishDepositTxRequest.class
);
startTimeout();
taskRunner.run();
@ -129,12 +133,12 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
() -> handleTaskRunnerSuccess("DepositTxPublishedMessage"),
this::handleTaskRunnerFault);
taskRunner.addTasks(ProcessDepositTxPublishedMessage.class,
PublishTradeStatistics.class);
taskRunner.addTasks(MakerProcessDepositTxPublishedMessage.class,
MakerPublishTradeStatistics.class);
taskRunner.run();
}
@ -147,11 +151,11 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
() -> handleTaskRunnerSuccess("FiatTransferStartedMessage"),
this::handleTaskRunnerFault);
taskRunner.addTasks(ProcessFiatTransferStartedMessage.class);
taskRunner.addTasks(SellerProcessFiatTransferStartedMessage.class);
taskRunner.run();
}
@ -163,14 +167,14 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
// User clicked the "bank transfer received" button, so we release the funds for pay out
@Override
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
if (sellerAsOffererTrade.getState().ordinal() <= Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG.ordinal()) {
if (sellerAsOffererTrade.getState() == Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG)
if (sellerAsMakerTrade.getState().ordinal() <= Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG.ordinal()) {
if (sellerAsMakerTrade.getState() == Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG)
log.warn("onFiatPaymentReceived called twice. " +
"That is expected if the app starts up and the other peer has still not continued.");
sellerAsOffererTrade.setState(Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT);
sellerAsMakerTrade.setState(Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
() -> {
resultHandler.handleResult();
handleTaskRunnerSuccess("onFiatPaymentReceived");
@ -181,16 +185,16 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
});
taskRunner.addTasks(
VerifyTakerAccount.class,
VerifyTakerFeePayment.class,
SignPayoutTx.class, //TODO: locktime
SellerAsOffererSendFinalizePayoutTxRequest.class //TODO: locktime
MakerVerifyTakerAccount.class,
MakerVerifyTakerFeePayment.class,
SellerAsMakerSignPayoutTx.class, //TODO: locktime
SellerAsMakerSendFinalizePayoutTxRequest.class //TODO: locktime
);
taskRunner.run();
} else {
log.warn("onFiatPaymentReceived called twice. " +
"That should not happen.\n" +
"state=" + sellerAsOffererTrade.getState());
"state=" + sellerAsMakerTrade.getState());
}
}
@ -198,7 +202,7 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
processModel.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender);
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsOffererTrade,
TradeTaskRunner taskRunner = new TradeTaskRunner(sellerAsMakerTrade,
() -> {
handleTaskRunnerSuccess("PayoutTxFinalizedMessage");
processModel.onComplete();
@ -206,7 +210,7 @@ public class SellerAsOffererProtocol extends TradeProtocol implements SellerProt
this::handleTaskRunnerFault);
taskRunner.addTasks(
ProcessPayoutTxFinalizedMessage.class,
SellerAsMakerProcessPayoutTxFinalizedMessage.class,
BroadcastPayoutTx.class //TODO: locktime
);
taskRunner.run();

View file

@ -22,7 +22,8 @@ import io.bisq.common.handlers.ErrorMessageHandler;
import io.bisq.common.handlers.ResultHandler;
import io.bisq.core.trade.SellerAsTakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.seller.*;
import io.bisq.core.trade.protocol.tasks.seller.SellerProcessFiatTransferStartedMessage;
import io.bisq.core.trade.protocol.tasks.seller_as_taker.*;
import io.bisq.core.trade.protocol.tasks.taker.*;
import io.bisq.protobuffer.message.Message;
import io.bisq.protobuffer.message.p2p.MailboxMessage;
@ -97,14 +98,14 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
this::handleTaskRunnerFault);
taskRunner.addTasks(
VerifyMakerAccount.class,
VerifyMakerFeePayment.class,
SelectArbitrator.class,
LoadCreateOfferFeeTx.class,
CreateTakeOfferFeeTx.class,
BroadcastTakeOfferFeeTx.class,
TakerAsSellerCreatesDepositTxInputs.class,
SendPayDepositRequest.class
TakerVerifyMakerAccount.class,
TakerVerifyMakerFeePayment.class,
TakerSelectArbitrator.class,
TakerLoadMakerFeeTx.class,
TakerCreateTakerFeeTx.class,
TakerBroadcastTakerFeeTx.class,
SellerAsTakerCreatesDepositTxInputs.class,
TakerSendPayDepositRequest.class
);
startTimeout();
taskRunner.run();
@ -126,13 +127,13 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
this::handleTaskRunnerFault);
taskRunner.addTasks(
ProcessPublishDepositTxRequest.class,
VerifyMakerAccount.class,
VerifyMakerFeePayment.class,
VerifyAndSignContract.class,
SignAndPublishDepositTxAsSeller.class,
SendDepositTxPublishedMessage.class,
PublishTradeStatistics.class
TakerProcessPublishDepositTxRequest.class,
TakerVerifyMakerAccount.class,
TakerVerifyMakerFeePayment.class,
TakerVerifyAndSignContract.class,
SellerAsTakerSignAndPublishDepositTx.class,
TakerSendDepositTxPublishedMessage.class,
TakerPublishTradeStatistics.class
);
taskRunner.run();
}
@ -150,9 +151,9 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
() -> handleTaskRunnerSuccess("FiatTransferStartedMessage"),
this::handleTaskRunnerFault);
taskRunner.addTasks(ProcessFiatTransferStartedMessage.class,
VerifyMakerAccount.class,
VerifyMakerFeePayment.class);
taskRunner.addTasks(SellerProcessFiatTransferStartedMessage.class,
TakerVerifyMakerAccount.class,
TakerVerifyMakerFeePayment.class);
taskRunner.run();
}
@ -165,8 +166,8 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
@Override
public void onFiatPaymentReceived(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
//TODO check states
if (sellerAsTakerTrade.getState().ordinal() <= Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG.ordinal()) {
if (sellerAsTakerTrade.getState() == Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG)
if (sellerAsTakerTrade.getState().ordinal() <= Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG.ordinal()) {
if (sellerAsTakerTrade.getState() == Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG)
log.warn("onFiatPaymentReceived called twice. " +
"That is expected if the app starts up and the other peer has still not continued.");
@ -183,8 +184,8 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
});
taskRunner.addTasks(
VerifyMakerAccount.class,
VerifyMakerFeePayment.class,
TakerVerifyMakerAccount.class,
TakerVerifyMakerFeePayment.class,
SellerAsTakerSignAndFinalizePayoutTx.class,
SellerAsTakerBroadcastPayoutTx.class,
SellerAsTakerSendPayoutTxPublishedMessage.class

View file

@ -19,7 +19,7 @@ package io.bisq.core.trade.protocol;
import io.bisq.common.Timer;
import io.bisq.common.UserThread;
import io.bisq.core.trade.OffererTrade;
import io.bisq.core.trade.MakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.TradeManager;
import io.bisq.network.p2p.DecryptedDirectMessageListener;
@ -136,8 +136,8 @@ public abstract class TradeProtocol {
private void cleanupTradable() {
Trade.State tradeState = trade.getState();
log.debug("cleanupTradable tradeState=" + tradeState);
boolean isOffererTrade = trade instanceof OffererTrade;
if (isOffererTrade && (tradeState == Trade.State.OFFERER_SENT_PUBLISH_DEPOSIT_TX_REQUEST || tradeState == Trade.State.DEPOSIT_SEEN_IN_NETWORK))
boolean isMakerTrade = trade instanceof MakerTrade;
if (isMakerTrade && (tradeState == Trade.State.MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST || tradeState == Trade.State.DEPOSIT_SEEN_IN_NETWORK))
processModel.getOpenOfferManager().closeOpenOffer(trade.getOffer());
//boolean isTakerTrade = trade instanceof TakerTrade;

View file

@ -29,9 +29,9 @@ import lombok.extern.slf4j.Slf4j;
import java.util.UUID;
@Slf4j
public class SendFiatTransferStartedMessage extends TradeTask {
public class BuyerSendFiatTransferStartedMessage extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SendFiatTransferStartedMessage(TaskRunner taskHandler, Trade trade) {
public BuyerSendFiatTransferStartedMessage(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -28,9 +28,9 @@ import org.bitcoinj.core.Address;
import org.bitcoinj.core.TransactionConfidence;
@Slf4j
public class SetupListenerForPayoutTx extends TradeTask {
public class BuyerSetupListenerForPayoutTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SetupListenerForPayoutTx(TaskRunner taskHandler, Trade trade) {
public BuyerSetupListenerForPayoutTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,11 +15,11 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.buyer;
package io.bisq.core.trade.protocol.tasks.buyer_as_maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
import io.bisq.core.btc.data.PreparedDepositTxAndOffererInputs;
import io.bisq.core.btc.data.PreparedDepositTxAndMakerInputs;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.TradingPeer;
@ -36,9 +36,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class OffererAsBuyerCreatesAndSignsDepositTx extends TradeTask {
public class BuyerAsMakerCreatesAndSignsDepositTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public OffererAsBuyerCreatesAndSignsDepositTx(TaskRunner taskHandler, Trade trade) {
public BuyerAsMakerCreatesAndSignsDepositTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -69,13 +69,13 @@ public class OffererAsBuyerCreatesAndSignsDepositTx extends TradeTask {
AddressEntry buyerMultiSigAddressEntry = addressEntryOptional.get();
buyerMultiSigAddressEntry.setCoinLockedInMultiSig(buyerInputAmount);
walletService.saveAddressEntryList();
Address offererAddress = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.RESERVED_FOR_TRADE).getAddress();
Address offererChangeAddress = walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE).getAddress();
Address makerAddress = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.RESERVED_FOR_TRADE).getAddress();
Address makerChangeAddress = walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE).getAddress();
TradingPeer tradingPeer = processModel.tradingPeer;
byte[] buyerMultiSigPubKey = processModel.getMyMultiSigPubKey();
checkArgument(Arrays.equals(buyerMultiSigPubKey, buyerMultiSigAddressEntry.getPubKey()),
"buyerMultiSigPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
PreparedDepositTxAndOffererInputs result = processModel.getTradeWalletService().offererCreatesAndSignsDepositTx(
PreparedDepositTxAndMakerInputs result = processModel.getTradeWalletService().makerCreatesAndSignsDepositTx(
true,
contractHash,
buyerInputAmount,
@ -83,14 +83,14 @@ public class OffererAsBuyerCreatesAndSignsDepositTx extends TradeTask {
tradingPeer.getRawTransactionInputs(),
tradingPeer.getChangeOutputValue(),
tradingPeer.getChangeOutputAddress(),
offererAddress,
offererChangeAddress,
makerAddress,
makerChangeAddress,
buyerMultiSigPubKey,
tradingPeer.getMultiSigPubKey(),
trade.getArbitratorPubKey());
processModel.setPreparedDepositTx(result.depositTransaction);
processModel.setRawTransactionInputs(result.rawOffererInputs);
processModel.setRawTransactionInputs(result.rawMakerInputs);
complete();
} catch (Throwable t) {

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.buyer;
package io.bisq.core.trade.protocol.tasks.buyer_as_maker;
import com.google.common.util.concurrent.FutureCallback;
import io.bisq.common.taskrunner.TaskRunner;
@ -30,9 +30,9 @@ import org.jetbrains.annotations.NotNull;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class BuyerAsOffererMightBroadcastPayoutTx extends TradeTask {
public class BuyerAsMakerMightBroadcastPayoutTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public BuyerAsOffererMightBroadcastPayoutTx(TaskRunner taskHandler, Trade trade) {
public BuyerAsMakerMightBroadcastPayoutTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.buyer;
package io.bisq.core.trade.protocol.tasks.buyer_as_maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.wallet.BtcWalletService;
@ -30,9 +30,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class BuyerProcessPayoutTxPublishedMessage extends TradeTask {
public class BuyerAsMakerProcessPayoutTxPublishedMessage extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public BuyerProcessPayoutTxPublishedMessage(TaskRunner taskHandler, Trade trade) {
public BuyerAsMakerProcessPayoutTxPublishedMessage(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.buyer;
package io.bisq.core.trade.protocol.tasks.buyer_as_maker;
import com.google.common.base.Preconditions;
import io.bisq.common.taskrunner.TaskRunner;
@ -32,10 +32,10 @@ import java.util.Arrays;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j
public class BuyerAsOffererSignPayoutTx extends TradeTask {
public class BuyerAsMakerSignPayoutTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public BuyerAsOffererSignPayoutTx(TaskRunner taskHandler, Trade trade) {
public BuyerAsMakerSignPayoutTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.buyer;
package io.bisq.core.trade.protocol.tasks.buyer_as_taker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
@ -28,10 +28,10 @@ import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
@Slf4j
public class TakerCreatesDepositTxInputsAsBuyer extends TradeTask {
public class BuyerAsTakerCreatesDepositTxInputs extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public TakerCreatesDepositTxInputsAsBuyer(TaskRunner taskHandler, Trade trade) {
public BuyerAsTakerCreatesDepositTxInputs(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.buyer;
package io.bisq.core.trade.protocol.tasks.buyer_as_taker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.taker;
package io.bisq.core.trade.protocol.tasks.buyer_as_taker;
import com.google.common.util.concurrent.FutureCallback;
import io.bisq.common.taskrunner.TaskRunner;

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import com.google.common.base.Preconditions;
import io.bisq.common.crypto.Sig;
@ -23,7 +23,7 @@ import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.common.util.Utilities;
import io.bisq.core.btc.AddressEntry;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.trade.BuyerAsOffererTrade;
import io.bisq.core.trade.BuyerAsMakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.TradingPeer;
import io.bisq.core.trade.protocol.tasks.TradeTask;
@ -36,9 +36,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class CreateAndSignContract extends TradeTask {
public class MakerCreateAndSignContract extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public CreateAndSignContract(TaskRunner taskHandler, Trade trade) {
public MakerCreateAndSignContract(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -49,22 +49,22 @@ public class CreateAndSignContract extends TradeTask {
Preconditions.checkNotNull(trade.getTakeOfferFeeTxId(), "trade.getTakeOfferFeeTxId() must not be null");
TradingPeer taker = processModel.tradingPeer;
PaymentAccountPayload offererPaymentAccountPayload = processModel.getPaymentAccountPayload(trade);
checkNotNull(offererPaymentAccountPayload, "offererPaymentAccountPayload must not be null");
PaymentAccountPayload makerPaymentAccountPayload = processModel.getPaymentAccountPayload(trade);
checkNotNull(makerPaymentAccountPayload, "makerPaymentAccountPayload must not be null");
PaymentAccountPayload takerPaymentAccountPayload = taker.getPaymentAccountPayload();
boolean isBuyerOffererAndSellerTaker = trade instanceof BuyerAsOffererTrade;
boolean isBuyerMakerAndSellerTaker = trade instanceof BuyerAsMakerTrade;
NodeAddress buyerNodeAddress = isBuyerOffererAndSellerTaker ?
NodeAddress buyerNodeAddress = isBuyerMakerAndSellerTaker ?
processModel.getMyNodeAddress() : processModel.getTempTradingPeerNodeAddress();
NodeAddress sellerNodeAddress = isBuyerOffererAndSellerTaker ?
NodeAddress sellerNodeAddress = isBuyerMakerAndSellerTaker ?
processModel.getTempTradingPeerNodeAddress() : processModel.getMyNodeAddress();
BtcWalletService walletService = processModel.getWalletService();
String id = processModel.getOffer().getId();
AddressEntry takerAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.TRADE_PAYOUT);
checkArgument(!walletService.getAddressEntry(id, AddressEntry.Context.MULTI_SIG).isPresent(),
"addressEntry must not be set here.");
AddressEntry offererAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG);
byte[] offererMultiSigPubKey = offererAddressEntry.getPubKey();
AddressEntry makerAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG);
byte[] makerMultiSigPubKey = makerAddressEntry.getPubKey();
Contract contract = new Contract(
processModel.getOffer().getOfferPayload(),
trade.getTradeAmount(),
@ -73,16 +73,16 @@ public class CreateAndSignContract extends TradeTask {
buyerNodeAddress,
sellerNodeAddress,
trade.getArbitratorNodeAddress(),
isBuyerOffererAndSellerTaker,
isBuyerMakerAndSellerTaker,
processModel.getAccountId(),
taker.getAccountId(),
offererPaymentAccountPayload,
makerPaymentAccountPayload,
takerPaymentAccountPayload,
processModel.getPubKeyRing(),
taker.getPubKeyRing(),
takerAddressEntry.getAddressString(),
taker.getPayoutAddressString(),
offererMultiSigPubKey,
makerMultiSigPubKey,
taker.getMultiSigPubKey()
);
String contractAsJson = Utilities.objectToJson(contract);
@ -90,8 +90,8 @@ public class CreateAndSignContract extends TradeTask {
trade.setContract(contract);
trade.setContractAsJson(contractAsJson);
trade.setOffererContractSignature(signature);
processModel.setMyMultiSigPubKey(offererMultiSigPubKey);
trade.setMakerContractSignature(signature);
processModel.setMyMultiSigPubKey(makerMultiSigPubKey);
complete();
} catch (Throwable t) {

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.trade.Trade;
@ -23,9 +23,9 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class LoadTakeOfferFeeTx extends TradeTask {
public class MakerLoadTakeOfferFeeTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public LoadTakeOfferFeeTx(TaskRunner taskHandler, Trade trade) {
public MakerLoadTakeOfferFeeTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,11 +15,11 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.trade.OffererTrade;
import io.bisq.core.trade.MakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.TradeTask;
import io.bisq.core.util.Validator;
@ -31,9 +31,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class ProcessDepositTxPublishedMessage extends TradeTask {
public class MakerProcessDepositTxPublishedMessage extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public ProcessDepositTxPublishedMessage(TaskRunner taskHandler, Trade trade) {
public MakerProcessDepositTxPublishedMessage(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -54,7 +54,7 @@ public class ProcessDepositTxPublishedMessage extends TradeTask {
trade.setDepositTx(walletTx);
BtcWalletService.printTx("depositTx received from peer", walletTx);
if (trade instanceof OffererTrade)
if (trade instanceof MakerTrade)
processModel.getOpenOfferManager().closeOpenOffer(trade.getOffer());
// update to the latest peer address of our peer if the message is correct
@ -62,7 +62,7 @@ public class ProcessDepositTxPublishedMessage extends TradeTask {
removeMailboxMessageAfterProcessing();
trade.setState(Trade.State.OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG);
trade.setState(Trade.State.MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG);
complete();
} catch (Throwable t) {

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.exceptions.TradePriceOutOfToleranceException;
@ -33,9 +33,9 @@ import static io.bisq.core.util.Validator.checkTradeId;
import static io.bisq.core.util.Validator.nonEmptyStringOf;
@Slf4j
public class ProcessPayDepositRequest extends TradeTask {
public class MakerProcessPayDepositRequest extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public ProcessPayDepositRequest(TaskRunner taskHandler, Trade trade) {
public MakerProcessPayDepositRequest(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,15 +15,15 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.TradeTask;
import io.bisq.protobuffer.payload.trade.statistics.TradeStatistics;
public class PublishTradeStatistics extends TradeTask {
public PublishTradeStatistics(TaskRunner taskHandler, Trade trade) {
public class MakerPublishTradeStatistics extends TradeTask {
public MakerPublishTradeStatistics(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -31,7 +31,7 @@ public class PublishTradeStatistics extends TradeTask {
protected void run() {
try {
runInterceptHook();
// Offerer is responsible for publishing. Only in case the offerer uses an old version the taker publishes.
// Maker is responsible for publishing. Only in case the maker uses an old version the taker publishes.
TradeStatistics tradeStatistics = new TradeStatistics(trade.getOffer().getOfferPayload(),
trade.getTradePrice(),
trade.getTradeAmount(),

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
@ -33,9 +33,9 @@ import java.util.UUID;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j
public class SendPublishDepositTxRequest extends TradeTask {
public class MakerSendPublishDepositTxRequest extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SendPublishDepositTxRequest(TaskRunner taskHandler, Trade trade) {
public MakerSendPublishDepositTxRequest(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -48,20 +48,20 @@ public class SendPublishDepositTxRequest extends TradeTask {
Optional<AddressEntry> addressEntryOptional = walletService.getAddressEntry(id, AddressEntry.Context.MULTI_SIG);
checkArgument(addressEntryOptional.isPresent(), "addressEntry must be set here.");
AddressEntry offererPayoutAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.TRADE_PAYOUT);
byte[] offererMultiSigPubKey = processModel.getMyMultiSigPubKey();
checkArgument(Arrays.equals(offererMultiSigPubKey,
AddressEntry makerPayoutAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.TRADE_PAYOUT);
byte[] makerMultiSigPubKey = processModel.getMyMultiSigPubKey();
checkArgument(Arrays.equals(makerMultiSigPubKey,
addressEntryOptional.get().getPubKey()),
"offererMultiSigPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
"makerMultiSigPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
PublishDepositTxRequest tradeMessage = new PublishDepositTxRequest(
processModel.getId(),
processModel.getPaymentAccountPayload(trade),
processModel.getAccountId(),
offererMultiSigPubKey,
makerMultiSigPubKey,
trade.getContractAsJson(),
trade.getOffererContractSignature(),
offererPayoutAddressEntry.getAddressString(),
trade.getMakerContractSignature(),
makerPayoutAddressEntry.getAddressString(),
processModel.getPreparedDepositTx(),
processModel.getRawTransactionInputs(),
processModel.getMyNodeAddress(),
@ -76,7 +76,7 @@ public class SendPublishDepositTxRequest extends TradeTask {
@Override
public void onArrived() {
log.trace("Message arrived at peer.");
trade.setState(Trade.State.OFFERER_SENT_PUBLISH_DEPOSIT_TX_REQUEST);
trade.setState(Trade.State.MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST);
complete();
}

View file

@ -15,14 +15,14 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.UserThread;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
import io.bisq.core.btc.listeners.BalanceListener;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.trade.OffererTrade;
import io.bisq.core.trade.MakerTrade;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@ -37,12 +37,12 @@ import org.fxmisc.easybind.Subscription;
// is already published. We set then the DEPOSIT_LOCKED state, so the user get informed that he is already in the critical state and need
// to request support.
@Slf4j
public class SetupDepositBalanceListener extends TradeTask {
public class MakerSetupDepositBalanceListener extends TradeTask {
private Subscription tradeStateSubscription;
private BalanceListener balanceListener;
@SuppressWarnings({"WeakerAccess", "unused"})
public SetupDepositBalanceListener(TaskRunner taskHandler, Trade trade) {
public MakerSetupDepositBalanceListener(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -64,7 +64,7 @@ public class SetupDepositBalanceListener extends TradeTask {
tradeStateSubscription = EasyBind.subscribe(trade.stateProperty(), newValue -> {
log.debug("tradeStateSubscription newValue " + newValue);
if (newValue == Trade.State.OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG
if (newValue == Trade.State.MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG
|| newValue == Trade.State.DEPOSIT_SEEN_IN_NETWORK) {
walletService.removeBalanceListener(balanceListener);
@ -90,10 +90,10 @@ public class SetupDepositBalanceListener extends TradeTask {
log.debug("pre tradeState " + trade.getState().toString());
Trade.State tradeState = trade.getState();
if (balance.isZero()) {
if (trade instanceof OffererTrade) {
if (trade instanceof MakerTrade) {
processModel.getOpenOfferManager().closeOpenOffer(trade.getOffer());
if (tradeState == Trade.State.OFFERER_SENT_PUBLISH_DEPOSIT_TX_REQUEST) {
if (tradeState == Trade.State.MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST) {
trade.setState(Trade.State.DEPOSIT_SEEN_IN_NETWORK);
} else if (tradeState.getPhase() == Trade.Phase.PREPARATION) {
processModel.getTradeManager().removePreparedTrade(trade);

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.trade.Trade;
@ -24,10 +24,10 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class VerifyArbitrationSelection extends TradeTask {
public class MakerVerifyArbitrationSelection extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public VerifyArbitrationSelection(TaskRunner taskHandler, Trade trade) {
public MakerVerifyArbitrationSelection(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.trade.Trade;
@ -23,9 +23,9 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class VerifyTakerAccount extends TradeTask {
public class MakerVerifyTakerAccount extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public VerifyTakerAccount(TaskRunner taskHandler, Trade trade) {
public MakerVerifyTakerAccount(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.offerer;
package io.bisq.core.trade.protocol.tasks.maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.trade.Trade;
@ -23,10 +23,10 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class VerifyTakerFeePayment extends TradeTask {
public class MakerVerifyTakerFeePayment extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public VerifyTakerFeePayment(TaskRunner taskHandler, Trade trade) {
public MakerVerifyTakerFeePayment(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -27,9 +27,9 @@ import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class ProcessFiatTransferStartedMessage extends TradeTask {
public class SellerProcessFiatTransferStartedMessage extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public ProcessFiatTransferStartedMessage(TaskRunner taskHandler, Trade trade) {
public SellerProcessFiatTransferStartedMessage(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,11 +15,11 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
import io.bisq.core.btc.data.PreparedDepositTxAndOffererInputs;
import io.bisq.core.btc.data.PreparedDepositTxAndMakerInputs;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.protocol.TradingPeer;
@ -36,9 +36,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class OffererAsSelleCreatesAndSignsDepositTx extends TradeTask {
public class SellerAsMakerCreatesAndSignsDepositTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public OffererAsSelleCreatesAndSignsDepositTx(TaskRunner taskHandler, Trade trade) {
public SellerAsMakerCreatesAndSignsDepositTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -72,10 +72,10 @@ public class OffererAsSelleCreatesAndSignsDepositTx extends TradeTask {
sellerMultiSigAddressEntry.getPubKey()),
"sellerMultiSigPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
Address offererAddress = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.RESERVED_FOR_TRADE).getAddress();
Address offererChangeAddress = walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE).getAddress();
Address makerAddress = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.RESERVED_FOR_TRADE).getAddress();
Address makerChangeAddress = walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE).getAddress();
TradingPeer tradingPeer = processModel.tradingPeer;
PreparedDepositTxAndOffererInputs result = processModel.getTradeWalletService().offererCreatesAndSignsDepositTx(
PreparedDepositTxAndMakerInputs result = processModel.getTradeWalletService().makerCreatesAndSignsDepositTx(
false,
contractHash,
sellerInputAmount,
@ -83,14 +83,14 @@ public class OffererAsSelleCreatesAndSignsDepositTx extends TradeTask {
tradingPeer.getRawTransactionInputs(),
tradingPeer.getChangeOutputValue(),
tradingPeer.getChangeOutputAddress(),
offererAddress,
offererChangeAddress,
makerAddress,
makerChangeAddress,
tradingPeer.getMultiSigPubKey(),
sellerMultiSigPubKey,
trade.getArbitratorPubKey());
processModel.setPreparedDepositTx(result.depositTransaction);
processModel.setRawTransactionInputs(result.rawOffererInputs);
processModel.setRawTransactionInputs(result.rawMakerInputs);
complete();
} catch (Throwable t) {

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.wallet.BtcWalletService;
@ -30,9 +30,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class ProcessPayoutTxFinalizedMessage extends TradeTask {
public class SellerAsMakerProcessPayoutTxFinalizedMessage extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public ProcessPayoutTxFinalizedMessage(TaskRunner taskHandler, Trade trade) {
public SellerAsMakerProcessPayoutTxFinalizedMessage(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_maker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
@ -30,9 +30,9 @@ import java.util.UUID;
@Slf4j
//TODO remove
public class SellerAsOffererSendFinalizePayoutTxRequest extends TradeTask {
public class SellerAsMakerSendFinalizePayoutTxRequest extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SellerAsOffererSendFinalizePayoutTxRequest(TaskRunner taskHandler, Trade trade) {
public SellerAsMakerSendFinalizePayoutTxRequest(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -62,14 +62,14 @@ public class SellerAsOffererSendFinalizePayoutTxRequest extends TradeTask {
@Override
public void onArrived() {
log.info("Message arrived at peer. tradeId={}, message{}", id, message);
trade.setState(Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG);
trade.setState(Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG);
complete();
}
@Override
public void onStoredInMailbox() {
log.info("Message stored in mailbox. tradeId={}, message{}", id, message);
trade.setState(Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG);
trade.setState(Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG);
complete();
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_maker;
import com.google.common.base.Preconditions;
import io.bisq.common.taskrunner.TaskRunner;
@ -32,10 +32,10 @@ import java.util.Arrays;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j
public class SignPayoutTx extends TradeTask {
public class SellerAsMakerSignPayoutTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SignPayoutTx(TaskRunner taskHandler, Trade trade) {
public SellerAsMakerSignPayoutTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_taker;
import com.google.common.util.concurrent.FutureCallback;
import io.bisq.common.taskrunner.TaskRunner;

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_taker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;
@ -28,9 +28,9 @@ import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
@Slf4j
public class TakerAsSellerCreatesDepositTxInputs extends TradeTask {
public class SellerAsTakerCreatesDepositTxInputs extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public TakerAsSellerCreatesDepositTxInputs(TaskRunner taskHandler, Trade trade) {
public SellerAsTakerCreatesDepositTxInputs(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_taker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.trade.Trade;

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.seller;
package io.bisq.core.trade.protocol.tasks.seller_as_taker;
import io.bisq.common.taskrunner.TaskRunner;
import io.bisq.core.btc.AddressEntry;

View file

@ -15,7 +15,7 @@
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bisq.core.trade.protocol.tasks.taker;
package io.bisq.core.trade.protocol.tasks.seller_as_taker;
import com.google.common.util.concurrent.FutureCallback;
import io.bisq.common.taskrunner.TaskRunner;
@ -38,9 +38,9 @@ import java.util.Optional;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j
public class SignAndPublishDepositTxAsSeller extends TradeTask {
public class SellerAsTakerSignAndPublishDepositTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SignAndPublishDepositTxAsSeller(TaskRunner taskHandler, Trade trade) {
public SellerAsTakerSignAndPublishDepositTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -26,9 +26,9 @@ import org.bitcoinj.core.Transaction;
import org.jetbrains.annotations.NotNull;
@Slf4j
public class BroadcastTakeOfferFeeTx extends TradeTask {
public class TakerBroadcastTakerFeeTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public BroadcastTakeOfferFeeTx(TaskRunner taskHandler, Trade trade) {
public TakerBroadcastTakerFeeTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -33,9 +33,9 @@ import org.bitcoinj.core.Transaction;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class CreateTakeOfferFeeTx extends TradeTask {
public class TakerCreateTakerFeeTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public CreateTakeOfferFeeTx(TaskRunner taskHandler, Trade trade) {
public TakerCreateTakerFeeTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -23,10 +23,10 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class LoadCreateOfferFeeTx extends TradeTask {
public class TakerLoadMakerFeeTx extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public LoadCreateOfferFeeTx(TaskRunner taskHandler, Trade trade) {
public TakerLoadMakerFeeTx(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -31,9 +31,9 @@ import static io.bisq.core.util.Validator.checkTradeId;
import static io.bisq.core.util.Validator.nonEmptyStringOf;
@Slf4j
public class ProcessPublishDepositTxRequest extends TradeTask {
public class TakerProcessPublishDepositTxRequest extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public ProcessPublishDepositTxRequest(TaskRunner taskHandler, Trade trade) {
public TakerProcessPublishDepositTxRequest(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -46,7 +46,7 @@ public class ProcessPublishDepositTxRequest extends TradeTask {
checkTradeId(processModel.getId(), publishDepositTxRequest);
checkNotNull(publishDepositTxRequest);
PaymentAccountPayload paymentAccountPayload = checkNotNull(publishDepositTxRequest.offererPaymentAccountPayload);
PaymentAccountPayload paymentAccountPayload = checkNotNull(publishDepositTxRequest.makerPaymentAccountPayload);
final PaymentAccountFilter[] appliedPaymentAccountFilter = new PaymentAccountFilter[1];
if (processModel.isPeersPaymentAccountDataAreBanned(paymentAccountPayload, appliedPaymentAccountFilter)) {
failed("Other trader is banned by his trading account data.\n" +
@ -56,14 +56,14 @@ public class ProcessPublishDepositTxRequest extends TradeTask {
}
processModel.tradingPeer.setPaymentAccountPayload(paymentAccountPayload);
processModel.tradingPeer.setAccountId(nonEmptyStringOf(publishDepositTxRequest.offererAccountId));
processModel.tradingPeer.setMultiSigPubKey(checkNotNull(publishDepositTxRequest.offererMultiSigPubKey));
processModel.tradingPeer.setContractAsJson(nonEmptyStringOf(publishDepositTxRequest.offererContractAsJson));
processModel.tradingPeer.setContractSignature(nonEmptyStringOf(publishDepositTxRequest.offererContractSignature));
processModel.tradingPeer.setPayoutAddressString(nonEmptyStringOf(publishDepositTxRequest.offererPayoutAddressString));
processModel.tradingPeer.setRawTransactionInputs(checkNotNull(publishDepositTxRequest.offererInputs));
processModel.tradingPeer.setAccountId(nonEmptyStringOf(publishDepositTxRequest.makerAccountId));
processModel.tradingPeer.setMultiSigPubKey(checkNotNull(publishDepositTxRequest.makerMultiSigPubKey));
processModel.tradingPeer.setContractAsJson(nonEmptyStringOf(publishDepositTxRequest.makerContractAsJson));
processModel.tradingPeer.setContractSignature(nonEmptyStringOf(publishDepositTxRequest.makerContractSignature));
processModel.tradingPeer.setPayoutAddressString(nonEmptyStringOf(publishDepositTxRequest.makerPayoutAddressString));
processModel.tradingPeer.setRawTransactionInputs(checkNotNull(publishDepositTxRequest.makerInputs));
processModel.setPreparedDepositTx(checkNotNull(publishDepositTxRequest.preparedDepositTx));
checkArgument(publishDepositTxRequest.offererInputs.size() > 0);
checkArgument(publishDepositTxRequest.makerInputs.size() > 0);
// update to the latest peer address of our peer if the message is correct
trade.setTradingPeerNodeAddress(processModel.getTempTradingPeerNodeAddress());

View file

@ -26,9 +26,9 @@ import lombok.extern.slf4j.Slf4j;
import java.util.List;
@Slf4j
public class PublishTradeStatistics extends TradeTask {
public class TakerPublishTradeStatistics extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public PublishTradeStatistics(TaskRunner taskHandler, Trade trade) {
public TakerPublishTradeStatistics(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -36,7 +36,7 @@ public class PublishTradeStatistics extends TradeTask {
protected void run() {
try {
runInterceptHook();
// Taker only publishes if the offerer uses an old version
// Taker only publishes if the maker uses an old version
processModel.getP2PService().getNetworkNode().getConfirmedConnections()
.stream()
.filter(c -> c.getPeersNodeAddressOptional().isPresent() && c.getPeersNodeAddressOptional().get().equals(trade.getTradingPeerNodeAddress()))
@ -63,10 +63,10 @@ public class PublishTradeStatistics extends TradeTask {
}
}
if (!matches) {
log.debug("We publish tradeStatistics because the offerer uses an old version so we publish to have at least 1 data item published.");
log.debug("We publish tradeStatistics because the maker uses an old version so we publish to have at least 1 data item published.");
processModel.getP2PService().addData(tradeStatistics, true);
} else {
log.trace("We do not publish tradeStatistics because the offerer support the capabilities.");
log.trace("We do not publish tradeStatistics because the maker support the capabilities.");
}
});
complete();

View file

@ -24,9 +24,9 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SelectArbitrator extends TradeTask {
public class TakerSelectArbitrator extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SelectArbitrator(TaskRunner taskHandler, Trade trade) {
public TakerSelectArbitrator(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -27,9 +27,9 @@ import lombok.extern.slf4j.Slf4j;
import java.util.UUID;
@Slf4j
public class SendDepositTxPublishedMessage extends TradeTask {
public class TakerSendDepositTxPublishedMessage extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SendDepositTxPublishedMessage(TaskRunner taskHandler, Trade trade) {
public TakerSendDepositTxPublishedMessage(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -32,9 +32,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class SendPayDepositRequest extends TradeTask {
public class TakerSendPayDepositRequest extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public SendPayDepositRequest(TaskRunner taskHandler, Trade trade) {
public TakerSendPayDepositRequest(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -38,9 +38,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class VerifyAndSignContract extends TradeTask {
public class TakerVerifyAndSignContract extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public VerifyAndSignContract(TaskRunner taskHandler, Trade trade) {
public TakerVerifyAndSignContract(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}
@ -51,14 +51,14 @@ public class VerifyAndSignContract extends TradeTask {
checkNotNull(trade.getTakeOfferFeeTxId(), "TakeOfferFeeTxId must not be null");
TradingPeer offerer = processModel.tradingPeer;
PaymentAccountPayload offererPaymentAccountPayload = offerer.getPaymentAccountPayload();
TradingPeer maker = processModel.tradingPeer;
PaymentAccountPayload makerPaymentAccountPayload = maker.getPaymentAccountPayload();
PaymentAccountPayload takerPaymentAccountPayload = processModel.getPaymentAccountPayload(trade);
boolean isBuyerOffererAndSellerTaker = trade instanceof SellerAsTakerTrade;
NodeAddress buyerNodeAddress = isBuyerOffererAndSellerTaker ? processModel.getTempTradingPeerNodeAddress() : processModel.getMyNodeAddress();
NodeAddress sellerNodeAddress = isBuyerOffererAndSellerTaker ? processModel.getMyNodeAddress() : processModel.getTempTradingPeerNodeAddress();
log.debug("isBuyerOffererAndSellerTaker " + isBuyerOffererAndSellerTaker);
boolean isBuyerMakerAndSellerTaker = trade instanceof SellerAsTakerTrade;
NodeAddress buyerNodeAddress = isBuyerMakerAndSellerTaker ? processModel.getTempTradingPeerNodeAddress() : processModel.getMyNodeAddress();
NodeAddress sellerNodeAddress = isBuyerMakerAndSellerTaker ? processModel.getMyNodeAddress() : processModel.getTempTradingPeerNodeAddress();
log.debug("isBuyerMakerAndSellerTaker " + isBuyerMakerAndSellerTaker);
log.debug("buyerAddress " + buyerNodeAddress);
log.debug("sellerAddress " + sellerNodeAddress);
@ -82,16 +82,16 @@ public class VerifyAndSignContract extends TradeTask {
buyerNodeAddress,
sellerNodeAddress,
trade.getArbitratorNodeAddress(),
isBuyerOffererAndSellerTaker,
offerer.getAccountId(),
isBuyerMakerAndSellerTaker,
maker.getAccountId(),
processModel.getAccountId(),
offererPaymentAccountPayload,
makerPaymentAccountPayload,
takerPaymentAccountPayload,
offerer.getPubKeyRing(),
maker.getPubKeyRing(),
processModel.getPubKeyRing(),
offerer.getPayoutAddressString(),
maker.getPayoutAddressString(),
takerPayoutAddressString,
offerer.getMultiSigPubKey(),
maker.getMultiSigPubKey(),
takerMultiSigPubKey
);
String contractAsJson = Utilities.objectToJson(contract);
@ -101,9 +101,9 @@ public class VerifyAndSignContract extends TradeTask {
trade.setTakerContractSignature(signature);
try {
Sig.verify(offerer.getPubKeyRing().getSignaturePubKey(),
Sig.verify(maker.getPubKeyRing().getSignaturePubKey(),
contractAsJson,
offerer.getContractSignature());
maker.getContractSignature());
} catch (Throwable t) {
failed("Signature verification failed. " + t.getMessage());
}

View file

@ -23,10 +23,10 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class VerifyMakerAccount extends TradeTask {
public class TakerVerifyMakerAccount extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public VerifyMakerAccount(TaskRunner taskHandler, Trade trade) {
public TakerVerifyMakerAccount(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -23,9 +23,9 @@ import io.bisq.core.trade.protocol.tasks.TradeTask;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class VerifyMakerFeePayment extends TradeTask {
public class TakerVerifyMakerFeePayment extends TradeTask {
@SuppressWarnings({"WeakerAccess", "unused"})
public VerifyMakerFeePayment(TaskRunner taskHandler, Trade trade) {
public TakerVerifyMakerFeePayment(TaskRunner taskHandler, Trade trade) {
super(taskHandler, trade);
}

View file

@ -109,7 +109,7 @@ public class TradeStatisticsManager {
dump();
} else {
log.debug("We have already an item with the same offer ID. That might happen if both the offerer and the taker published the tradeStatistics");
log.debug("We have already an item with the same offer ID. That might happen if both the maker and the taker published the tradeStatistics");
}
}
}

View file

@ -105,11 +105,11 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
public boolean onDeleteAccount(PaymentAccount paymentAccount) {
boolean isPaymentAccountUsed = openOfferManager.getOpenOffers().stream()
.filter(o -> o.getOffer().getOffererPaymentAccountId().equals(paymentAccount.getId()))
.filter(o -> o.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()))
.findAny()
.isPresent();
isPaymentAccountUsed = isPaymentAccountUsed || tradeManager.getTrades().stream()
.filter(t -> t.getOffer().getOffererPaymentAccountId().equals(paymentAccount.getId()) ||
.filter(t -> t.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()) ||
paymentAccount.getId().equals(t.getTakerPaymentAccountId()))
.findAny()
.isPresent();

View file

@ -106,11 +106,11 @@ class FiatAccountsDataModel extends ActivatableDataModel {
public boolean onDeleteAccount(PaymentAccount paymentAccount) {
boolean isPaymentAccountUsed = openOfferManager.getOpenOffers().stream()
.filter(o -> o.getOffer().getOffererPaymentAccountId().equals(paymentAccount.getId()))
.filter(o -> o.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()))
.findAny()
.isPresent();
isPaymentAccountUsed = isPaymentAccountUsed || tradeManager.getTrades().stream()
.filter(t -> t.getOffer().getOffererPaymentAccountId().equals(paymentAccount.getId()) ||
.filter(t -> t.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()) ||
paymentAccount.getId().equals(t.getTakerPaymentAccountId()))
.findAny()
.isPresent();

View file

@ -26,13 +26,22 @@ import io.bisq.core.offer.placeoffer.tasks.AddOfferToRemoteOfferBook;
import io.bisq.core.offer.placeoffer.tasks.BroadcastCreateOfferFeeTx;
import io.bisq.core.offer.placeoffer.tasks.CreateOfferFeeTx;
import io.bisq.core.offer.placeoffer.tasks.ValidateOffer;
import io.bisq.core.trade.protocol.BuyerAsOffererProtocol;
import io.bisq.core.trade.protocol.BuyerAsMakerProtocol;
import io.bisq.core.trade.protocol.BuyerAsTakerProtocol;
import io.bisq.core.trade.protocol.SellerAsOffererProtocol;
import io.bisq.core.trade.protocol.SellerAsMakerProtocol;
import io.bisq.core.trade.protocol.SellerAsTakerProtocol;
import io.bisq.core.trade.protocol.tasks.buyer.*;
import io.bisq.core.trade.protocol.tasks.offerer.*;
import io.bisq.core.trade.protocol.tasks.seller.*;
import io.bisq.core.trade.protocol.tasks.buyer.BuyerSendFiatTransferStartedMessage;
import io.bisq.core.trade.protocol.tasks.buyer.ProcessFinalizePayoutTxRequest;
import io.bisq.core.trade.protocol.tasks.buyer.SendPayoutTxFinalizedMessage;
import io.bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerCreatesAndSignsDepositTx;
import io.bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerSignAndFinalizePayoutTx;
import io.bisq.core.trade.protocol.tasks.maker.*;
import io.bisq.core.trade.protocol.tasks.seller.SellerProcessFiatTransferStartedMessage;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerProcessPayoutTxFinalizedMessage;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerSendFinalizePayoutTxRequest;
import io.bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerSignPayoutTx;
import io.bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerCreatesDepositTxInputs;
import io.bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerSignAndPublishDepositTx;
import io.bisq.core.trade.protocol.tasks.shared.BroadcastPayoutTx;
import io.bisq.core.trade.protocol.tasks.taker.*;
import io.bisq.gui.common.view.FxmlView;
@ -85,20 +94,20 @@ public class DebugView extends InitializableView {
/*---- Protocol ----*/
BuyerAsOffererProtocol.class,
ProcessPayDepositRequest.class,
VerifyArbitrationSelection.class,
VerifyTakerAccount.class,
CreateAndSignContract.class,
OffererAsBuyerCreatesAndSignsDepositTx.class,
LoadTakeOfferFeeTx.class,
SetupDepositBalanceListener.class,
SendPublishDepositTxRequest.class,
BuyerAsMakerProtocol.class,
MakerProcessPayDepositRequest.class,
MakerVerifyArbitrationSelection.class,
MakerVerifyTakerAccount.class,
MakerCreateAndSignContract.class,
BuyerAsMakerCreatesAndSignsDepositTx.class,
MakerLoadTakeOfferFeeTx.class,
MakerSetupDepositBalanceListener.class,
MakerSendPublishDepositTxRequest.class,
ProcessDepositTxPublishedMessage.class,
MakerProcessDepositTxPublishedMessage.class,
VerifyTakerFeePayment.class,
SendFiatTransferStartedMessage.class,
MakerVerifyTakerFeePayment.class,
BuyerSendFiatTransferStartedMessage.class,
ProcessFinalizePayoutTxRequest.class,
BuyerAsTakerSignAndFinalizePayoutTx.class,
@ -109,25 +118,25 @@ public class DebugView extends InitializableView {
/*---- Protocol ----*/
SellerAsTakerProtocol.class,
SelectArbitrator.class,
CreateTakeOfferFeeTx.class,
BroadcastTakeOfferFeeTx.class,
TakerAsSellerCreatesDepositTxInputs.class,
SendPayDepositRequest.class,
TakerSelectArbitrator.class,
TakerCreateTakerFeeTx.class,
TakerBroadcastTakerFeeTx.class,
SellerAsTakerCreatesDepositTxInputs.class,
TakerSendPayDepositRequest.class,
ProcessPublishDepositTxRequest.class,
VerifyMakerAccount.class,
VerifyAndSignContract.class,
SignAndPublishDepositTxAsSeller.class,
SendDepositTxPublishedMessage.class,
TakerProcessPublishDepositTxRequest.class,
TakerVerifyMakerAccount.class,
TakerVerifyAndSignContract.class,
SellerAsTakerSignAndPublishDepositTx.class,
TakerSendDepositTxPublishedMessage.class,
ProcessFiatTransferStartedMessage.class,
SellerProcessFiatTransferStartedMessage.class,
VerifyMakerFeePayment.class,
SignPayoutTx.class,
SellerAsOffererSendFinalizePayoutTxRequest.class,
TakerVerifyMakerFeePayment.class,
SellerAsMakerSignPayoutTx.class,
SellerAsMakerSendFinalizePayoutTxRequest.class,
ProcessPayoutTxFinalizedMessage.class,
SellerAsMakerProcessPayoutTxFinalizedMessage.class,
BroadcastPayoutTx.class,
Boolean.class /* used as separator*/
)
@ -135,21 +144,21 @@ public class DebugView extends InitializableView {
final ObservableList<Class> items2 = FXCollections.observableArrayList(Arrays.asList(
/*---- Protocol ----*/
BuyerAsTakerProtocol.class,
SelectArbitrator.class,
CreateTakeOfferFeeTx.class,
BroadcastTakeOfferFeeTx.class,
TakerAsSellerCreatesDepositTxInputs.class,
SendPayDepositRequest.class,
TakerSelectArbitrator.class,
TakerCreateTakerFeeTx.class,
TakerBroadcastTakerFeeTx.class,
SellerAsTakerCreatesDepositTxInputs.class,
TakerSendPayDepositRequest.class,
ProcessPublishDepositTxRequest.class,
VerifyMakerAccount.class,
VerifyAndSignContract.class,
SignAndPublishDepositTxAsSeller.class,
SendDepositTxPublishedMessage.class,
TakerProcessPublishDepositTxRequest.class,
TakerVerifyMakerAccount.class,
TakerVerifyAndSignContract.class,
SellerAsTakerSignAndPublishDepositTx.class,
TakerSendDepositTxPublishedMessage.class,
VerifyMakerFeePayment.class,
SignPayoutTx.class,
SendFiatTransferStartedMessage.class,
TakerVerifyMakerFeePayment.class,
SellerAsMakerSignPayoutTx.class,
BuyerSendFiatTransferStartedMessage.class,
ProcessFinalizePayoutTxRequest.class,
BuyerAsTakerSignAndFinalizePayoutTx.class,
@ -159,24 +168,24 @@ public class DebugView extends InitializableView {
/*---- Protocol ----*/
SellerAsOffererProtocol.class,
ProcessPayDepositRequest.class,
VerifyArbitrationSelection.class,
VerifyTakerAccount.class,
CreateAndSignContract.class,
OffererAsBuyerCreatesAndSignsDepositTx.class,
SetupDepositBalanceListener.class,
SendPublishDepositTxRequest.class,
SellerAsMakerProtocol.class,
MakerProcessPayDepositRequest.class,
MakerVerifyArbitrationSelection.class,
MakerVerifyTakerAccount.class,
MakerCreateAndSignContract.class,
BuyerAsMakerCreatesAndSignsDepositTx.class,
MakerSetupDepositBalanceListener.class,
MakerSendPublishDepositTxRequest.class,
ProcessDepositTxPublishedMessage.class,
MakerProcessDepositTxPublishedMessage.class,
ProcessFiatTransferStartedMessage.class,
SellerProcessFiatTransferStartedMessage.class,
VerifyTakerFeePayment.class,
SignPayoutTx.class,
SellerAsOffererSendFinalizePayoutTxRequest.class,
MakerVerifyTakerFeePayment.class,
SellerAsMakerSignPayoutTx.class,
SellerAsMakerSendFinalizePayoutTxRequest.class,
ProcessPayoutTxFinalizedMessage.class,
SellerAsMakerProcessPayoutTxFinalizedMessage.class,
BroadcastPayoutTx.class,
Boolean.class /* used as separator*/
)

View file

@ -1181,7 +1181,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
public void updateItem(final Dispute item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (item.isDisputeOpenerIsOfferer())
if (item.isDisputeOpenerIsMaker())
setText(item.isDisputeOpenerIsBuyer() ? Res.get("support.buyerOfferer") : Res.get("support.sellerOfferer"));
else
setText(item.isDisputeOpenerIsBuyer() ? Res.get("support.buyerTaker") : Res.get("support.sellerTaker"));

View file

@ -244,7 +244,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
if (!preferences.getUseStickyMarketPrice())
priceFeedService.setCurrencyCode(tradeCurrencyCode.get());
// The offerer only pays the mining fee for the trade fee tx (not the mining fee for other trade txs).
// The maker only pays the mining fee for the trade fee tx (not the mining fee for other trade txs).
// A typical trade fee tx has about 226 bytes (if one input). We use 400 as a safe value.
// We cannot use tx size calculation as we do not know initially how the input is funded. And we require the
// fee for getting the funds needed.
@ -531,7 +531,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
}
void calculateTotalToPay() {
// Offerer does not pay the tx fee for the trade txs because the mining fee might be different when offerer
// Maker does not pay the tx fee for the trade txs because the mining fee might be different when maker
// created the offer and reserved his funds, so that would not work well with dynamic fees.
// The mining fee for the createOfferFee tx is deducted from the createOfferFee and not visible to the trader
if (direction != null && amount.get() != null && createOfferFeeAsCoin != null) {

View file

@ -84,7 +84,7 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
// If we would change the price representation in the domain we would not be backward compatible
final StringProperty price = new SimpleStringProperty();
// Positive % value means always a better price form the offerer's perspective:
// Positive % value means always a better price form the maker's perspective:
// Buyer (with fiat): lower price as market
// Buyer (with altcoin): higher (display) price as market (display price is inverted)
final StringProperty marketPriceMargin = new SimpleStringProperty();

View file

@ -444,7 +444,7 @@ class OfferBookViewModel extends ActivatableViewModel {
}
boolean isIgnored(Offer offer) {
return preferences.getIgnoreTradersList().stream().filter(i -> i.equals(offer.getOffererNodeAddress().getHostNameWithoutPostFix())).findAny().isPresent();
return preferences.getIgnoreTradersList().stream().filter(i -> i.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix())).findAny().isPresent();
}
boolean isOfferBanned(Offer offer) {
@ -458,7 +458,7 @@ class OfferBookViewModel extends ActivatableViewModel {
boolean isNodeBanned(Offer offer) {
return filterManager.getFilter() != null &&
filterManager.getFilter().bannedNodeAddress.stream()
.filter(e -> e.equals(offer.getOffererNodeAddress().getHostNameWithoutPostFix()))
.filter(e -> e.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix()))
.findAny()
.isPresent();
}
@ -480,7 +480,7 @@ class OfferBookViewModel extends ActivatableViewModel {
.filter(e -> {
final NodeAddress tradingPeerNodeAddress = e instanceof Trade ? ((Trade) e).getTradingPeerNodeAddress() : null;
return tradingPeerNodeAddress != null &&
tradingPeerNodeAddress.hostName.equals(offer.getOffererNodeAddress().hostName);
tradingPeerNodeAddress.hostName.equals(offer.getMakerNodeAddress().hostName);
})
.collect(Collectors.toSet())
.size();

View file

@ -173,7 +173,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
getBuyerSecurityDeposit() :
getSellerSecurityDeposit();
// Taker pays 2 times the tx fee because the mining fee might be different when offerer created the offer
// Taker pays 2 times the tx fee because the mining fee might be different when maker created the offer
// and reserved his funds, so that would not work well with dynamic fees.
// The mining fee for the takeOfferFee tx is deducted from the takeOfferFee and not visible to the trader
@ -362,7 +362,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
}
void calculateTotalToPay() {
// Taker pays 2 times the tx fee because the mining fee might be different when offerer created the offer
// Taker pays 2 times the tx fee because the mining fee might be different when maker created the offer
// and reserved his funds, so that would not work well with dynamic fees.
// The mining fee for the takeOfferFee tx is deducted from the createOfferFee and not visible to the trader
if (offer != null && amountAsCoin.get() != null && takerFeeAsCoin != null) {
@ -438,7 +438,7 @@ class TakeOfferDataModel extends ActivatableDataModel {
return true;
}
boolean wouldCreateDustForOfferer() {
boolean wouldCreateDustForMaker() {
//noinspection SimplifiableIfStatement
if (amountAsCoin.get() != null && offer != null) {
Coin customAmount = offer.getAmount().subtract(amountAsCoin.get());

View file

@ -255,7 +255,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
amountValidationResult.set(new InputValidator.ValidationResult(false,
Res.get("takeOffer.validation.amountLargerThanOfferAmount")));
if (dataModel.wouldCreateDustForOfferer())
if (dataModel.wouldCreateDustForMaker())
amountValidationResult.set(new InputValidator.ValidationResult(false,
Res.get("takeOffer.validation.amountLargerThanOfferAmountMinusFee")));
}
@ -298,7 +298,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
takeOfferRequested = false;
break;
case OFFERER_OFFLINE:
case MAKER_OFFLINE:
if (takeOfferRequested)
offerWarning.set(Res.get("takeOffer.failed.offererNotOnline"));
else
@ -355,7 +355,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
if (trade.getState() == Trade.State.TAKER_PUBLISHED_DEPOSIT_TX
|| trade.getState() == Trade.State.DEPOSIT_SEEN_IN_NETWORK
|| trade.getState() == Trade.State.TAKER_SENT_DEPOSIT_TX_PUBLISHED_MSG
|| trade.getState() == Trade.State.OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG) {
|| trade.getState() == Trade.State.MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG) {
if (trade.getDepositTx() != null) {
if (takeOfferSucceededHandler != null)
takeOfferSucceededHandler.run();
@ -373,7 +373,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
&& dataModel.isMinAmountLessOrEqualAmount()
&& !dataModel.isAmountLargerThanOfferAmount()
&& isOfferAvailable.get()
&& !dataModel.wouldCreateDustForOfferer();
&& !dataModel.wouldCreateDustForMaker();
isNextButtonDisabled.set(!inputDataValid);
// boolean notSufficientFees = dataModel.isWalletFunded.get() && dataModel.isMainNet.get() && !dataModel.isFeeFromFundingTxSufficient.get();
// isTakeOfferButtonDisabled.set(takeOfferRequested || !inputDataValid || notSufficientFees);
@ -424,7 +424,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
@Override
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
if (connection.getPeersNodeAddressOptional().isPresent() &&
connection.getPeersNodeAddressOptional().get().equals(offer.getOffererNodeAddress())) {
connection.getPeersNodeAddressOptional().get().equals(offer.getMakerNodeAddress())) {
offerWarning.set(Res.get("takeOffer.warning.connectionToPeerLost"));
updateSpinnerInfo();
}

View file

@ -149,7 +149,7 @@ public class PeerInfoWithTagEditor extends Overlay<PeerInfoWithTagEditor> {
keyEventEventHandler = event -> {
if (new KeyCodeCombination(KeyCode.R, KeyCombination.ALT_DOWN).match(event)) {
new SendPrivateNotificationWindow(offer.getPubKeyRing(), offer.getOffererNodeAddress())
new SendPrivateNotificationWindow(offer.getPubKeyRing(), offer.getMakerNodeAddress())
.onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid)
.show();
}

View file

@ -153,7 +153,7 @@ public class NotificationCenter {
} else {
if (tradeManager.isBuyer(trade.getOffer())) {
switch (tradeState) {
case OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
case MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
message = Res.get("notification.trade.accepted", Res.get("shared.seller"));
break;
case DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN:
@ -162,7 +162,7 @@ public class NotificationCenter {
}
} else {
switch (tradeState) {
case OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
case MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
message = Res.get("notification.trade.accepted", Res.get("shared.buyer"));
break;
case SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG:

View file

@ -231,7 +231,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
addTitledGroupBg(gridPane, ++rowIndex, 16, Res.get("disputeSummaryWindow.title"));
addLabelTextField(gridPane, rowIndex, Res.getWithCol("shared.tradeId"), dispute.getShortTradeId(), Layout.FIRST_ROW_DISTANCE);
addLabelTextField(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.openDate"), formatter.formatDateTime(dispute.getOpeningDate()));
if (dispute.isDisputeOpenerIsOfferer()) {
if (dispute.isDisputeOpenerIsMaker()) {
if (dispute.isDisputeOpenerIsBuyer())
role = Res.get("support.buyerOfferer");
else

View file

@ -211,8 +211,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
}
}
final PaymentMethod paymentMethod = offer.getPaymentMethod();
final String offererPaymentAccountId = offer.getOffererPaymentAccountId();
final PaymentAccount paymentAccount = user.getPaymentAccount(offererPaymentAccountId);
final String makerPaymentAccountId = offer.getMakerPaymentAccountId();
final PaymentAccount paymentAccount = user.getPaymentAccount(makerPaymentAccountId);
String bankId = offer.getBankId();
if (bankId == null || bankId.equals("null"))
bankId = "";
@ -221,7 +221,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
final boolean isSpecificBanks = paymentMethod.equals(PaymentMethod.SPECIFIC_BANKS);
final boolean isNationalBanks = paymentMethod.equals(PaymentMethod.NATIONAL_BANK);
final boolean isSepa = paymentMethod.equals(PaymentMethod.SEPA);
if (offer.isMyOffer(keyRing) && offererPaymentAccountId != null && paymentAccount != null) {
if (offer.isMyOffer(keyRing) && makerPaymentAccountId != null && paymentAccount != null) {
addLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.myTradingAccount"), paymentAccount.getAccountName());
} else {
final String method = Res.get(paymentMethod.getId());
@ -285,7 +285,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
addLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.getWithCol("shared.offerId"), offer.getId(),
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("offerDetailsWindow.makersOnion"),
offer.getOffererNodeAddress().getFullAddress());
offer.getMakerNodeAddress().getFullAddress());
addLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.creationDate"),
formatter.formatDateTime(offer.getDate()));
String value = Res.getWithColAndCap("shared.buyer") +

View file

@ -83,7 +83,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
final ObservableList<PendingTradesListItem> list = FXCollections.observableArrayList();
private final ListChangeListener<Trade> tradesListChangeListener;
private boolean isOfferer;
private boolean isMaker;
final ObjectProperty<PendingTradesListItem> selectedItemProperty = new SimpleObjectProperty<>();
public final StringProperty txId = new SimpleStringProperty();
@ -212,22 +212,22 @@ public class PendingTradesDataModel extends ActivatableDataModel {
}
boolean isBuyer() {
return (isOfferer(getOffer()) && isBuyOffer())
|| (!isOfferer(getOffer()) && !isBuyOffer());
return (isMaker(getOffer()) && isBuyOffer())
|| (!isMaker(getOffer()) && !isBuyOffer());
}
boolean isOfferer(Offer offer) {
boolean isMaker(Offer offer) {
return tradeManager.isMyOffer(offer);
}
private boolean isOfferer() {
return isOfferer;
private boolean isMaker() {
return isMaker;
}
Coin getTotalFees() {
Trade trade = getTrade();
if (trade != null) {
if (isOfferer()) {
if (isMaker()) {
Offer offer = trade.getOffer();
return offer.getCreateOfferFee().add(offer.getTxFee());
} else {
@ -244,8 +244,8 @@ public class PendingTradesDataModel extends ActivatableDataModel {
}
public Offer.Direction getDirection(Offer offer) {
isOfferer = tradeManager.isMyOffer(offer);
return isOfferer ? offer.getDirection() : offer.getMirroredDirection();
isMaker = tradeManager.isMyOffer(offer);
return isMaker ? offer.getDirection() : offer.getMirroredDirection();
}
void addBlockChainListener(BlockChainListener blockChainListener) {
@ -310,7 +310,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
private void doSelectItem(PendingTradesListItem item) {
if (item != null) {
Trade trade = item.getTrade();
isOfferer = tradeManager.isMyOffer(trade.getOffer());
isMaker = tradeManager.isMyOffer(trade.getOffer());
if (trade.getDepositTx() != null)
txId.set(trade.getDepositTx().getHashAsString());
else
@ -386,8 +386,8 @@ public class PendingTradesDataModel extends ActivatableDataModel {
Dispute dispute = new Dispute(disputeManager.getDisputeStorage(),
trade.getId(),
keyRing.getPubKeyRing().hashCode(), // traderId
trade.getOffer().getDirection() == Offer.Direction.BUY ? isOfferer : !isOfferer,
isOfferer,
trade.getOffer().getDirection() == Offer.Direction.BUY ? isMaker : !isMaker,
isMaker,
keyRing.getPubKeyRing(),
trade.getDate(),
trade.getContract(),
@ -397,7 +397,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
depositTxHashAsString,
payoutTxHashAsString,
trade.getContractAsJson(),
trade.getOffererContractSignature(),
trade.getMakerContractSignature(),
trade.getTakerContractSignature(),
acceptedArbitratorByAddress.getPubKeyRing(),
isSupportTicket

View file

@ -215,7 +215,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
Contract contract = trade.getContract();
if (contract != null) {
Offer offer = trade.getOffer();
return formatter.getRole(contract.isBuyerOffererAndSellerTaker(), dataModel.isOfferer(offer), offer.getCurrencyCode());
return formatter.getRole(contract.isBuyerMakerAndSellerTaker(), dataModel.isMaker(offer), offer.getCurrencyCode());
} else {
return "";
}
@ -326,11 +326,11 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
break;
case TAKER_FEE_PAID:
case OFFERER_SENT_PUBLISH_DEPOSIT_TX_REQUEST:
case MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST:
case TAKER_PUBLISHED_DEPOSIT_TX:
case DEPOSIT_SEEN_IN_NETWORK:
case TAKER_SENT_DEPOSIT_TX_PUBLISHED_MSG:
case OFFERER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
case MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
sellerState.set(WAIT_FOR_BLOCKCHAIN_CONFIRMATION);
buyerState.set(BuyerState.WAIT_FOR_BLOCKCHAIN_CONFIRMATION);
break;
@ -348,7 +348,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
case SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT: // we stick with the state until we get the msg sent success
sellerState.set(REQUEST_CONFIRM_FIAT_PAYMENT_RECEIVED);
break;
case SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG: // todo remove?
case SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG: // todo remove?
sellerState.set(WAIT_FOR_PAYOUT_TX);
break;
case BUYER_RECEIVED_FIAT_PAYMENT_RECEIPT_MSG:

View file

@ -99,7 +99,7 @@ public class SellerStep3View extends TradeStepView {
} else if (state == Trade.State.SELLER_CONFIRMED_FIAT_PAYMENT_RECEIPT && confirmButton.isDisabled()) {
showStatusInfo();
} else if (state == Trade.State.SELLER_AS_OFFERER_SENT_FIAT_PAYMENT_RECEIPT_MSG) {
} else if (state == Trade.State.SELLER_AS_MAKER_SENT_FIAT_PAYMENT_RECEIPT_MSG) {
hideStatusInfo();
}
});

View file

@ -652,25 +652,25 @@ public class BSFormatter {
}
}
public String getRole(boolean isBuyerOffererAndSellerTaker, boolean isOfferer, String currencyCode) {
public String getRole(boolean isBuyerMakerAndSellerTaker, boolean isMaker, String currencyCode) {
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
String btc = "BTC";
if (isBuyerOffererAndSellerTaker)
return isOfferer ?
if (isBuyerMakerAndSellerTaker)
return isMaker ?
Res.get("formatter.asMaker", btc, Res.get("shared.buyer")) :
Res.get("formatter.asTaker", btc, Res.get("shared.seller"));
else
return isOfferer ?
return isMaker ?
Res.get("formatter.asMaker", btc, Res.get("shared.seller")) :
Res.get("formatter.asTaker", btc, Res.get("shared.buyer"));
} else {
String btc = "BTC";
if (isBuyerOffererAndSellerTaker)
return isOfferer ?
if (isBuyerMakerAndSellerTaker)
return isMaker ?
Res.get("formatter.asMaker", currencyCode, Res.get("shared.seller")) :
Res.get("formatter.asTaker", currencyCode, Res.get("shared.buyer"));
else
return isOfferer ?
return isMaker ?
Res.get("formatter.asMaker", currencyCode, Res.get("shared.buyer")) :
Res.get("formatter.asTaker", currencyCode, Res.get("shared.seller"));
}

View file

@ -217,18 +217,18 @@ public class ProtoBufferUtilities {
}
private static Message getPublishDepositTxRequest(PB.PublishDepositTxRequest publishDepositTxRequest) {
List<RawTransactionInput> rawTransactionInputs = publishDepositTxRequest.getOffererInputsList().stream()
List<RawTransactionInput> rawTransactionInputs = publishDepositTxRequest.getMakerInputsList().stream()
.map(rawTransactionInput -> new RawTransactionInput(rawTransactionInput.getIndex(),
rawTransactionInput.getParentTransaction().toByteArray(), rawTransactionInput.getValue()))
.collect(Collectors.toList());
return new PublishDepositTxRequest(publishDepositTxRequest.getTradeId(),
getPaymentAccountPayload(publishDepositTxRequest.getOffererPaymentAccountPayload()),
publishDepositTxRequest.getOffererAccountId(),
publishDepositTxRequest.getOffererMultiSigPubKey().toByteArray(),
publishDepositTxRequest.getOffererContractAsJson(),
publishDepositTxRequest.getOffererContractSignature(),
publishDepositTxRequest.getOffererPayoutAddressString(),
getPaymentAccountPayload(publishDepositTxRequest.getMakerPaymentAccountPayload()),
publishDepositTxRequest.getMakerAccountId(),
publishDepositTxRequest.getMakerMultiSigPubKey().toByteArray(),
publishDepositTxRequest.getMakerContractAsJson(),
publishDepositTxRequest.getMakerContractSignature(),
publishDepositTxRequest.getMakerPayoutAddressString(),
publishDepositTxRequest.getPreparedDepositTx().toByteArray(),
rawTransactionInputs,
getNodeAddress(publishDepositTxRequest.getSenderNodeAddress()),
@ -297,10 +297,10 @@ public class ProtoBufferUtilities {
private static Dispute getDispute(PB.Dispute dispute) {
return new Dispute(dispute.getTradeId(), dispute.getTraderId(),
dispute.getDisputeOpenerIsBuyer(), dispute.getDisputeOpenerIsOfferer(),
dispute.getDisputeOpenerIsBuyer(), dispute.getDisputeOpenerIsMaker(),
getPubKeyRing(dispute.getTraderPubKeyRing()), new Date(dispute.getTradeDate()), getContract(dispute.getContract()),
dispute.getContractHash().toByteArray(), dispute.getDepositTxSerialized().toByteArray(), dispute.getPayoutTxSerialized().toByteArray(),
dispute.getDepositTxId(), dispute.getPayoutTxId(), dispute.getContractAsJson(), dispute.getOffererContractSignature(),
dispute.getDepositTxId(), dispute.getPayoutTxId(), dispute.getContractAsJson(), dispute.getMakerContractSignature(),
dispute.getTakerContractSignature(), getPubKeyRing(dispute.getArbitratorPubKeyRing()), dispute.getIsSupportTicket());
}
@ -313,16 +313,16 @@ public class ProtoBufferUtilities {
getNodeAddress(contract.getBuyerNodeAddress()),
getNodeAddress(contract.getSellerNodeAddress()),
getNodeAddress(contract.getArbitratorNodeAddress()),
contract.getIsBuyerOffererAndSellerTaker(),
contract.getOffererAccountId(),
contract.getIsBuyerMakerAndSellerTaker(),
contract.getMakerAccountId(),
contract.getTakerAccountId(),
getPaymentAccountPayload(contract.getOffererPaymentAccountPayload()),
getPaymentAccountPayload(contract.getMakerPaymentAccountPayload()),
getPaymentAccountPayload(contract.getTakerPaymentAccountPayload()),
getPubKeyRing(contract.getOffererPubKeyRing()),
getPubKeyRing(contract.getMakerPubKeyRing()),
getPubKeyRing(contract.getTakerPubKeyRing()),
contract.getOffererPayoutAddressString(),
contract.getMakerPayoutAddressString(),
contract.getTakerPayoutAddressString(),
contract.getOffererBtcPubKey().toByteArray(),
contract.getMakerBtcPubKey().toByteArray(),
contract.getTakerBtcPubKey().toByteArray());
}
@ -479,7 +479,7 @@ public class ProtoBufferUtilities {
return new OfferPayload(pbOffer.getId(),
pbOffer.getDate(),
getNodeAddress(pbOffer.getOffererNodeAddress()),
getNodeAddress(pbOffer.getMakerNodeAddress()),
getPubKeyRing(pbOffer.getPubKeyRing()),
getDirection(pbOffer.getDirection()),
pbOffer.getPrice(),
@ -492,7 +492,7 @@ public class ProtoBufferUtilities {
arbitratorNodeAddresses,
mediatorNodeAddresses,
pbOffer.getPaymentMethodId(),
pbOffer.getOffererPaymentAccountId(),
pbOffer.getMakerPaymentAccountId(),
offerFeePaymentTxId,
countryCode,
acceptedCountryCodes,

View file

@ -47,44 +47,44 @@ public final class PublishDepositTxRequest extends TradeMessage implements Mailb
private static final Logger log = LoggerFactory.getLogger(PublishDepositTxRequest.class);
public final PaymentAccountPayload offererPaymentAccountPayload;
public final String offererAccountId;
public final String offererContractAsJson;
public final String offererContractSignature;
public final String offererPayoutAddressString;
public final PaymentAccountPayload makerPaymentAccountPayload;
public final String makerAccountId;
public final String makerContractAsJson;
public final String makerContractSignature;
public final String makerPayoutAddressString;
public final byte[] preparedDepositTx;
public final List<RawTransactionInput> offererInputs;
public final byte[] offererMultiSigPubKey;
public final List<RawTransactionInput> makerInputs;
public final byte[] makerMultiSigPubKey;
private final NodeAddress senderNodeAddress;
private final String uid;
public PublishDepositTxRequest(String tradeId,
PaymentAccountPayload offererPaymentAccountPayload,
String offererAccountId,
byte[] offererMultiSigPubKey,
String offererContractAsJson,
String offererContractSignature,
String offererPayoutAddressString,
PaymentAccountPayload makerPaymentAccountPayload,
String makerAccountId,
byte[] makerMultiSigPubKey,
String makerContractAsJson,
String makerContractSignature,
String makerPayoutAddressString,
byte[] preparedDepositTx,
List<RawTransactionInput> offererInputs,
List<RawTransactionInput> makerInputs,
NodeAddress senderNodeAddress,
String uid) {
super(tradeId);
this.offererPaymentAccountPayload = offererPaymentAccountPayload;
this.offererAccountId = offererAccountId;
this.offererMultiSigPubKey = offererMultiSigPubKey;
this.offererContractAsJson = offererContractAsJson;
this.offererContractSignature = offererContractSignature;
this.offererPayoutAddressString = offererPayoutAddressString;
this.makerPaymentAccountPayload = makerPaymentAccountPayload;
this.makerAccountId = makerAccountId;
this.makerMultiSigPubKey = makerMultiSigPubKey;
this.makerContractAsJson = makerContractAsJson;
this.makerContractSignature = makerContractSignature;
this.makerPayoutAddressString = makerPayoutAddressString;
this.preparedDepositTx = preparedDepositTx;
this.offererInputs = offererInputs;
this.makerInputs = makerInputs;
this.senderNodeAddress = senderNodeAddress;
this.uid = uid;
log.trace("offererPaymentAccount size " + Utilities.serialize(offererPaymentAccountPayload).length);
log.trace("offererTradeWalletPubKey size " + offererMultiSigPubKey.length);
log.trace("makerPaymentAccount size " + Utilities.serialize(makerPaymentAccountPayload).length);
log.trace("makerTradeWalletPubKey size " + makerMultiSigPubKey.length);
log.trace("preparedDepositTx size " + preparedDepositTx.length);
log.trace("offererInputs size " + Utilities.serialize(new ArrayList<>(offererInputs)).length);
log.trace("makerInputs size " + Utilities.serialize(new ArrayList<>(makerInputs)).length);
}
@Override
@ -93,29 +93,29 @@ public final class PublishDepositTxRequest extends TradeMessage implements Mailb
return baseEnvelope.setPublishDepositTxRequest(baseEnvelope.getPublishDepositTxRequestBuilder()
.setMessageVersion(getMessageVersion())
.setTradeId(tradeId)
.setOffererPaymentAccountPayload((PB.PaymentAccountPayload) offererPaymentAccountPayload.toProto())
.setOffererAccountId(offererAccountId)
.setOffererMultiSigPubKey(ByteString.copyFrom(offererMultiSigPubKey))
.setOffererContractAsJson(offererContractAsJson)
.setOffererContractSignature(offererContractSignature)
.setOffererPayoutAddressString(offererPayoutAddressString)
.setMakerPaymentAccountPayload((PB.PaymentAccountPayload) makerPaymentAccountPayload.toProto())
.setMakerAccountId(makerAccountId)
.setMakerMultiSigPubKey(ByteString.copyFrom(makerMultiSigPubKey))
.setMakerContractAsJson(makerContractAsJson)
.setMakerContractSignature(makerContractSignature)
.setMakerPayoutAddressString(makerPayoutAddressString)
.setPreparedDepositTx(ByteString.copyFrom(preparedDepositTx))
.setSenderNodeAddress(senderNodeAddress.toProto())
.setUid(uid)
.addAllOffererInputs(offererInputs.stream().map(rawTransactionInput -> rawTransactionInput.toProto()).collect(Collectors.toList()))).build();
.addAllMakerInputs(makerInputs.stream().map(rawTransactionInput -> rawTransactionInput.toProto()).collect(Collectors.toList()))).build();
}
@Override
public String toString() {
return "PublishDepositTxRequest{" +
"offererPaymentAccountPayload=" + offererPaymentAccountPayload +
", offererAccountId='" + offererAccountId + '\'' +
", offererContractAsJson='" + offererContractAsJson + '\'' +
", offererContractSignature='" + offererContractSignature + '\'' +
", offererPayoutAddressString='" + offererPayoutAddressString + '\'' +
"makerPaymentAccountPayload=" + makerPaymentAccountPayload +
", makerAccountId='" + makerAccountId + '\'' +
", makerContractAsJson='" + makerContractAsJson + '\'' +
", makerContractSignature='" + makerContractSignature + '\'' +
", makerPayoutAddressString='" + makerPayoutAddressString + '\'' +
", preparedDepositTx=" + Arrays.toString(preparedDepositTx) +
", offererInputs=" + offererInputs +
", offererMultiSigPubKey=" + Arrays.toString(offererMultiSigPubKey) +
", makerInputs=" + makerInputs +
", makerMultiSigPubKey=" + Arrays.toString(makerMultiSigPubKey) +
"} " + super.toString();
}

View file

@ -5,7 +5,7 @@ import io.bisq.protobuffer.payload.p2p.NodeAddress;
/**
* Used for network_messages which require that the data owner is online.
* <p>
* This is used for the offers to avoid dead offers in case the offerer is in standby mode or the app has
* This is used for the offers to avoid dead offers in case the maker is in standby mode or the app has
* terminated without sending the remove message (e.g. network connection lost or in case of a crash).
*/
public interface RequiresOwnerIsOnlinePayload extends Payload {

View file

@ -57,7 +57,7 @@ public final class Dispute implements Payload {
private final String id;
private final int traderId;
private final boolean disputeOpenerIsBuyer;
private final boolean disputeOpenerIsOfferer;
private final boolean disputeOpenerIsMaker;
private final long openingDate;
private final PubKeyRing traderPubKeyRing;
private final long tradeDate;
@ -73,7 +73,7 @@ public final class Dispute implements Payload {
private final String payoutTxId;
private final String contractAsJson;
@Nullable
private final String offererContractSignature;
private final String makerContractSignature;
@Nullable
private final String takerContractSignature;
private final PubKeyRing arbitratorPubKeyRing;
@ -104,7 +104,7 @@ public final class Dispute implements Payload {
String tradeId,
int traderId,
boolean disputeOpenerIsBuyer,
boolean disputeOpenerIsOfferer,
boolean disputeOpenerIsMaker,
PubKeyRing traderPubKeyRing,
Date tradeDate,
Contract contract,
@ -114,14 +114,14 @@ public final class Dispute implements Payload {
@Nullable String depositTxId,
@Nullable String payoutTxId,
String contractAsJson,
@Nullable String offererContractSignature,
@Nullable String makerContractSignature,
@Nullable String takerContractSignature,
PubKeyRing arbitratorPubKeyRing,
boolean isSupportTicket) {
this(tradeId,
traderId,
disputeOpenerIsBuyer,
disputeOpenerIsOfferer,
disputeOpenerIsMaker,
traderPubKeyRing,
tradeDate,
contract,
@ -131,7 +131,7 @@ public final class Dispute implements Payload {
depositTxId,
payoutTxId,
contractAsJson,
offererContractSignature,
makerContractSignature,
takerContractSignature,
arbitratorPubKeyRing,
isSupportTicket);
@ -141,7 +141,7 @@ public final class Dispute implements Payload {
public Dispute(String tradeId,
int traderId,
boolean disputeOpenerIsBuyer,
boolean disputeOpenerIsOfferer,
boolean disputeOpenerIsMaker,
PubKeyRing traderPubKeyRing,
Date tradeDate,
Contract contract,
@ -151,14 +151,14 @@ public final class Dispute implements Payload {
@Nullable String depositTxId,
@Nullable String payoutTxId,
String contractAsJson,
@Nullable String offererContractSignature,
@Nullable String makerContractSignature,
@Nullable String takerContractSignature,
PubKeyRing arbitratorPubKeyRing,
boolean isSupportTicket) {
this.tradeId = tradeId;
this.traderId = traderId;
this.disputeOpenerIsBuyer = disputeOpenerIsBuyer;
this.disputeOpenerIsOfferer = disputeOpenerIsOfferer;
this.disputeOpenerIsMaker = disputeOpenerIsMaker;
this.traderPubKeyRing = traderPubKeyRing;
this.tradeDate = tradeDate.getTime();
this.contract = contract;
@ -168,7 +168,7 @@ public final class Dispute implements Payload {
this.depositTxId = depositTxId;
this.payoutTxId = payoutTxId;
this.contractAsJson = contractAsJson;
this.offererContractSignature = offererContractSignature;
this.makerContractSignature = makerContractSignature;
this.takerContractSignature = takerContractSignature;
this.arbitratorPubKeyRing = arbitratorPubKeyRing;
this.isSupportTicket = isSupportTicket;
@ -261,8 +261,8 @@ public final class Dispute implements Payload {
return disputeOpenerIsBuyer;
}
public boolean isDisputeOpenerIsOfferer() {
return disputeOpenerIsOfferer;
public boolean isDisputeOpenerIsMaker() {
return disputeOpenerIsMaker;
}
public Date getOpeningDate() {
@ -302,8 +302,8 @@ public final class Dispute implements Payload {
}
@Nullable
public String getOffererContractSignature() {
return offererContractSignature;
public String getMakerContractSignature() {
return makerContractSignature;
}
@Nullable
@ -356,7 +356,7 @@ public final class Dispute implements Payload {
", id='" + id + '\'' +
", traderId=" + traderId +
", disputeOpenerIsBuyer=" + disputeOpenerIsBuyer +
", disputeOpenerIsOfferer=" + disputeOpenerIsOfferer +
", disputeOpenerIsMaker=" + disputeOpenerIsMaker +
", openingDate=" + openingDate +
", traderPubKeyRing=" + traderPubKeyRing +
", tradeDate=" + tradeDate +
@ -367,7 +367,7 @@ public final class Dispute implements Payload {
", depositTxId='" + depositTxId + '\'' +
", payoutTxId='" + payoutTxId + '\'' +
", contractAsJson='" + contractAsJson + '\'' +
", offererContractSignature='" + offererContractSignature + '\'' +
", makerContractSignature='" + makerContractSignature + '\'' +
", takerContractSignature='" + takerContractSignature + '\'' +
", arbitratorPubKeyRing=" + arbitratorPubKeyRing +
", isSupportTicket=" + isSupportTicket +
@ -388,7 +388,7 @@ public final class Dispute implements Payload {
.setId(id)
.setTraderId(traderId)
.setDisputeOpenerIsBuyer(disputeOpenerIsBuyer)
.setDisputeOpenerIsOfferer(disputeOpenerIsOfferer)
.setDisputeOpenerIsMaker(disputeOpenerIsMaker)
.setOpeningDate(openingDate)
.setTraderPubKeyRing(traderPubKeyRing.toProto())
.setTradeDate(tradeDate)
@ -407,7 +407,7 @@ public final class Dispute implements Payload {
Optional.ofNullable(payoutTxId).ifPresent(builder::setPayoutTxId);
Optional.ofNullable(disputePayoutTxId).ifPresent(builder::setDisputePayoutTxId);
Optional.ofNullable(takerContractSignature).ifPresent(builder::setTakerContractSignature);
Optional.ofNullable(offererContractSignature).ifPresent(builder::setOffererContractSignature);
Optional.ofNullable(makerContractSignature).ifPresent(builder::setMakerContractSignature);
Optional.ofNullable(disputeResult).ifPresent(result -> builder.setDisputeResult(disputeResult.toProto()));
return builder.build();
}

View file

@ -101,10 +101,10 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
private final double marketPriceMargin;
private final long amount;
private final long minAmount;
private final NodeAddress offererNodeAddress;
private final NodeAddress makerNodeAddress;
@JsonExclude
private final PubKeyRing pubKeyRing;
private final String offererPaymentAccountId;
private final String makerPaymentAccountId;
// Mutable property. Has to be set before offer is save in P2P network as it changes the objects hash!
@Setter
@ -152,7 +152,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
*
* @param id
* @param date date of OfferPayload creation, can be null in which case the current date/time will be used.
* @param offererNodeAddress
* @param makerNodeAddress
* @param pubKeyRing
* @param direction
* @param price
@ -165,7 +165,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
* @param arbitratorNodeAddresses
* @param mediatorNodeAddresses
* @param paymentMethodId
* @param offererPaymentAccountId
* @param makerPaymentAccountId
* @param offerFeePaymentTxId
* @param countryCode
* @param acceptedCountryCodes
@ -190,7 +190,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
@SuppressWarnings("JavaDoc")
public OfferPayload(String id,
long date,
NodeAddress offererNodeAddress,
NodeAddress makerNodeAddress,
PubKeyRing pubKeyRing,
Direction direction,
long price,
@ -203,7 +203,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
List<NodeAddress> arbitratorNodeAddresses,
List<NodeAddress> mediatorNodeAddresses,
String paymentMethodId,
String offererPaymentAccountId,
String makerPaymentAccountId,
@Nullable String offerFeePaymentTxId,
@Nullable String countryCode,
@Nullable List<String> acceptedCountryCodes,
@ -227,7 +227,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
this.id = id;
this.date = date;
this.offererNodeAddress = offererNodeAddress;
this.makerNodeAddress = makerNodeAddress;
this.pubKeyRing = pubKeyRing;
this.direction = direction;
this.price = price;
@ -240,7 +240,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
this.arbitratorNodeAddresses = arbitratorNodeAddresses;
this.mediatorNodeAddresses = mediatorNodeAddresses;
this.paymentMethodId = paymentMethodId;
this.offererPaymentAccountId = offererPaymentAccountId;
this.makerPaymentAccountId = makerPaymentAccountId;
this.offerFeePaymentTxId = offerFeePaymentTxId;
this.countryCode = countryCode;
this.acceptedCountryCodes = acceptedCountryCodes;
@ -272,7 +272,7 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
@Override
public NodeAddress getOwnerNodeAddress() {
return offererNodeAddress;
return makerNodeAddress;
}
@Override
@ -308,9 +308,9 @@ public final class OfferPayload implements StoragePayload, RequiresOwnerIsOnline
.setMarketPriceMargin(marketPriceMargin)
.setAmount(amount)
.setMinAmount(minAmount)
.setOffererNodeAddress(offererNodeAddress.toProto())
.setMakerNodeAddress(makerNodeAddress.toProto())
.setPubKeyRing(pubKeyRing.toProto())
.setOffererPaymentAccountId(offererPaymentAccountId)
.setMakerPaymentAccountId(makerPaymentAccountId)
.setVersionNr(versionNr)
.setBlockHeightAtOfferCreation(blockHeightAtOfferCreation)
.setTxFee(txFee)

View file

@ -51,23 +51,23 @@ public final class Contract implements Payload {
private final long tradePrice;
public final String takeOfferFeeTxID;
public final NodeAddress arbitratorNodeAddress;
private final boolean isBuyerOffererAndSellerTaker;
private final String offererAccountId;
private final boolean isBuyerMakerAndSellerTaker;
private final String makerAccountId;
private final String takerAccountId;
private final PaymentAccountPayload offererPaymentAccountPayload;
private final PaymentAccountPayload makerPaymentAccountPayload;
private final PaymentAccountPayload takerPaymentAccountPayload;
@JsonExclude
private final PubKeyRing offererPubKeyRing;
private final PubKeyRing makerPubKeyRing;
@JsonExclude
private final PubKeyRing takerPubKeyRing;
@Getter
private final NodeAddress buyerNodeAddress;
@Getter
private final NodeAddress sellerNodeAddress;
private final String offererPayoutAddressString;
private final String makerPayoutAddressString;
private final String takerPayoutAddressString;
@JsonExclude
private final byte[] offererMultiSigPubKey;
private final byte[] makerMultiSigPubKey;
@JsonExclude
private final byte[] takerMultiSigPubKey;
@ -78,16 +78,16 @@ public final class Contract implements Payload {
NodeAddress buyerNodeAddress,
NodeAddress sellerNodeAddress,
NodeAddress arbitratorNodeAddress,
boolean isBuyerOffererAndSellerTaker,
String offererAccountId,
boolean isBuyerMakerAndSellerTaker,
String makerAccountId,
String takerAccountId,
PaymentAccountPayload offererPaymentAccountPayload,
PaymentAccountPayload makerPaymentAccountPayload,
PaymentAccountPayload takerPaymentAccountPayload,
PubKeyRing offererPubKeyRing,
PubKeyRing makerPubKeyRing,
PubKeyRing takerPubKeyRing,
String offererPayoutAddressString,
String makerPayoutAddressString,
String takerPayoutAddressString,
byte[] offererMultiSigPubKey,
byte[] makerMultiSigPubKey,
byte[] takerMultiSigPubKey) {
this.offerPayload = offerPayload;
this.tradePrice = tradePrice.getValue();
@ -96,72 +96,72 @@ public final class Contract implements Payload {
this.tradeAmount = tradeAmount.value;
this.takeOfferFeeTxID = takeOfferFeeTxID;
this.arbitratorNodeAddress = arbitratorNodeAddress;
this.isBuyerOffererAndSellerTaker = isBuyerOffererAndSellerTaker;
this.offererAccountId = offererAccountId;
this.isBuyerMakerAndSellerTaker = isBuyerMakerAndSellerTaker;
this.makerAccountId = makerAccountId;
this.takerAccountId = takerAccountId;
this.offererPaymentAccountPayload = offererPaymentAccountPayload;
this.makerPaymentAccountPayload = makerPaymentAccountPayload;
this.takerPaymentAccountPayload = takerPaymentAccountPayload;
this.offererPubKeyRing = offererPubKeyRing;
this.makerPubKeyRing = makerPubKeyRing;
this.takerPubKeyRing = takerPubKeyRing;
this.offererPayoutAddressString = offererPayoutAddressString;
this.makerPayoutAddressString = makerPayoutAddressString;
this.takerPayoutAddressString = takerPayoutAddressString;
this.offererMultiSigPubKey = offererMultiSigPubKey;
this.makerMultiSigPubKey = makerMultiSigPubKey;
this.takerMultiSigPubKey = takerMultiSigPubKey;
// PaymentMethod need to be the same
Preconditions.checkArgument(offererPaymentAccountPayload.getPaymentMethodId()
Preconditions.checkArgument(makerPaymentAccountPayload.getPaymentMethodId()
.equals(takerPaymentAccountPayload.getPaymentMethodId()),
"payment methods of maker and taker must be the same.\n" +
"offererPaymentMethodId=" + offererPaymentAccountPayload.getPaymentMethodId() + "\n" +
"makerPaymentMethodId=" + makerPaymentAccountPayload.getPaymentMethodId() + "\n" +
"takerPaymentMethodId=" + takerPaymentAccountPayload.getPaymentMethodId());
}
public boolean isBuyerOffererAndSellerTaker() {
return isBuyerOffererAndSellerTaker;
public boolean isBuyerMakerAndSellerTaker() {
return isBuyerMakerAndSellerTaker;
}
public String getBuyerAccountId() {
return isBuyerOffererAndSellerTaker ? offererAccountId : takerAccountId;
return isBuyerMakerAndSellerTaker ? makerAccountId : takerAccountId;
}
public String getSellerAccountId() {
return isBuyerOffererAndSellerTaker ? takerAccountId : offererAccountId;
return isBuyerMakerAndSellerTaker ? takerAccountId : makerAccountId;
}
public String getBuyerPayoutAddressString() {
return isBuyerOffererAndSellerTaker ? offererPayoutAddressString : takerPayoutAddressString;
return isBuyerMakerAndSellerTaker ? makerPayoutAddressString : takerPayoutAddressString;
}
public String getSellerPayoutAddressString() {
return isBuyerOffererAndSellerTaker ? takerPayoutAddressString : offererPayoutAddressString;
return isBuyerMakerAndSellerTaker ? takerPayoutAddressString : makerPayoutAddressString;
}
public PubKeyRing getBuyerPubKeyRing() {
return isBuyerOffererAndSellerTaker ? offererPubKeyRing : takerPubKeyRing;
return isBuyerMakerAndSellerTaker ? makerPubKeyRing : takerPubKeyRing;
}
public PubKeyRing getSellerPubKeyRing() {
return isBuyerOffererAndSellerTaker ? takerPubKeyRing : offererPubKeyRing;
return isBuyerMakerAndSellerTaker ? takerPubKeyRing : makerPubKeyRing;
}
public byte[] getBuyerMultiSigPubKey() {
return isBuyerOffererAndSellerTaker ? offererMultiSigPubKey : takerMultiSigPubKey;
return isBuyerMakerAndSellerTaker ? makerMultiSigPubKey : takerMultiSigPubKey;
}
public byte[] getSellerMultiSigPubKey() {
return isBuyerOffererAndSellerTaker ? takerMultiSigPubKey : offererMultiSigPubKey;
return isBuyerMakerAndSellerTaker ? takerMultiSigPubKey : makerMultiSigPubKey;
}
public PaymentAccountPayload getBuyerPaymentAccountPayload() {
return isBuyerOffererAndSellerTaker ? offererPaymentAccountPayload : takerPaymentAccountPayload;
return isBuyerMakerAndSellerTaker ? makerPaymentAccountPayload : takerPaymentAccountPayload;
}
public PaymentAccountPayload getSellerPaymentAccountPayload() {
return isBuyerOffererAndSellerTaker ? takerPaymentAccountPayload : offererPaymentAccountPayload;
return isBuyerMakerAndSellerTaker ? takerPaymentAccountPayload : makerPaymentAccountPayload;
}
public String getPaymentMethodId() {
return offererPaymentAccountPayload.getPaymentMethodId();
return makerPaymentAccountPayload.getPaymentMethodId();
}
public Coin getTradeAmount() {
@ -181,18 +181,18 @@ public final class Contract implements Payload {
.setTradePrice(tradePrice)
.setTakeOfferFeeTxId(takeOfferFeeTxID)
.setArbitratorNodeAddress(arbitratorNodeAddress.toProto())
.setIsBuyerOffererAndSellerTaker(isBuyerOffererAndSellerTaker)
.setOffererAccountId(offererAccountId)
.setIsBuyerMakerAndSellerTaker(isBuyerMakerAndSellerTaker)
.setMakerAccountId(makerAccountId)
.setTakerAccountId(takerAccountId)
.setOffererPaymentAccountPayload((PB.PaymentAccountPayload) offererPaymentAccountPayload.toProto())
.setMakerPaymentAccountPayload((PB.PaymentAccountPayload) makerPaymentAccountPayload.toProto())
.setTakerPaymentAccountPayload((PB.PaymentAccountPayload) takerPaymentAccountPayload.toProto())
.setOffererPubKeyRing(offererPubKeyRing.toProto())
.setMakerPubKeyRing(makerPubKeyRing.toProto())
.setTakerPubKeyRing(takerPubKeyRing.toProto())
.setBuyerNodeAddress(buyerNodeAddress.toProto())
.setSellerNodeAddress(sellerNodeAddress.toProto())
.setOffererPayoutAddressString(offererPayoutAddressString)
.setMakerPayoutAddressString(makerPayoutAddressString)
.setTakerPayoutAddressString(takerPayoutAddressString)
.setOffererBtcPubKey(ByteString.copyFrom(offererMultiSigPubKey))
.setMakerBtcPubKey(ByteString.copyFrom(makerMultiSigPubKey))
.setTakerBtcPubKey(ByteString.copyFrom(takerMultiSigPubKey)).build();
}
@ -204,18 +204,18 @@ public final class Contract implements Payload {
"\n\ttradePrice=" + tradePrice +
"\n\ttakeOfferFeeTxID='" + takeOfferFeeTxID + '\'' +
"\n\tarbitratorAddress=" + arbitratorNodeAddress +
"\n\tisBuyerOffererAndSellerTaker=" + isBuyerOffererAndSellerTaker +
"\n\toffererAccountId='" + offererAccountId + '\'' +
"\n\tisBuyerMakerAndSellerTaker=" + isBuyerMakerAndSellerTaker +
"\n\tmakerAccountId='" + makerAccountId + '\'' +
"\n\ttakerAccountId='" + takerAccountId + '\'' +
"\n\toffererPaymentAccountPayload=" + offererPaymentAccountPayload +
"\n\tmakerPaymentAccountPayload=" + makerPaymentAccountPayload +
"\n\ttakerPaymentAccountPayload=" + takerPaymentAccountPayload +
"\n\toffererPubKeyRing=" + offererPubKeyRing +
"\n\tmakerPubKeyRing=" + makerPubKeyRing +
"\n\ttakerPubKeyRing=" + takerPubKeyRing +
"\n\tbuyerAddress=" + buyerNodeAddress +
"\n\tsellerAddress=" + sellerNodeAddress +
"\n\toffererPayoutAddressString='" + offererPayoutAddressString + '\'' +
"\n\tmakerPayoutAddressString='" + makerPayoutAddressString + '\'' +
"\n\ttakerPayoutAddressString='" + takerPayoutAddressString + '\'' +
"\n\toffererMultiSigPubKey=" + Hex.toHexString(offererMultiSigPubKey) +
"\n\tmakerMultiSigPubKey=" + Hex.toHexString(makerMultiSigPubKey) +
"\n\ttakerMultiSigPubKey=" + Hex.toHexString(takerMultiSigPubKey) +
"\n\tBuyerMultiSigPubKey=" + Hex.toHexString(getBuyerMultiSigPubKey()) +
"\n\tSellerMultiSigPubKey=" + Hex.toHexString(getSellerMultiSigPubKey()) +

View file

@ -184,9 +184,9 @@ public final class TradeStatistics implements LazyProcessedStoragePayload, Capab
}
// We don't include the pubKeyRing as both traders might publish it if the offerer uses an old
// version and update later (taker publishes first, then later offerer)
// We also don't include the trade date as that is set locally and different for offerer and taker
// We don't include the pubKeyRing as both traders might publish it if the maker uses an old
// version and update later (taker publishes first, then later maker)
// We also don't include the trade date as that is set locally and different for maker and taker
@Override
public int hashCode() {
int result;

View file

@ -316,9 +316,9 @@ message OfferPayload {
double market_price_margin = 16;
int64 amount = 17;
int64 min_amount = 18;
NodeAddress offerer_node_address = 19;
NodeAddress maker_node_address = 19;
PubKeyRing pub_key_ring = 20;
string offerer_payment_account_id = 21;
string maker_payment_account_id = 21;
string offer_fee_payment_tx_id = 22;
string version_nr = 23;
int64 block_height_at_offer_creation = 24;
@ -434,7 +434,7 @@ message Dispute {
string id = 2;
int32 trader_id = 3;
bool dispute_opener_is_buyer = 4;
bool dispute_opener_is_offerer = 5;
bool dispute_opener_is_maker = 5;
int64 opening_date = 6;
PubKeyRing trader_pub_key_ring = 7;
int64 trade_date = 8;
@ -445,7 +445,7 @@ message Dispute {
string deposit_tx_id = 13;
string payout_tx_id = 14;
string contract_as_json = 15;
string offerer_contract_signature = 16;
string maker_contract_signature = 16;
string taker_contract_signature = 17;
PubKeyRing arbitrator_pub_key_ring = 18;
bool is_support_ticket = 19;
@ -466,18 +466,18 @@ message Contract {
int64 trade_price = 3;
string take_offer_fee_tx_id = 4;
NodeAddress arbitrator_node_address = 5;
bool is_buyer_offerer_and_seller_taker = 6;
string offerer_account_id = 7;
bool is_buyer_maker_and_seller_taker = 6;
string maker_account_id = 7;
string taker_account_id = 8;
PaymentAccountPayload offerer_payment_account_payload = 9;
PaymentAccountPayload maker_payment_account_payload = 9;
PaymentAccountPayload taker_payment_account_payload = 10;
PubKeyRing offerer_pub_key_ring = 11;
PubKeyRing maker_pub_key_ring = 11;
PubKeyRing taker_pub_key_ring = 12;
NodeAddress buyer_node_address = 13;
NodeAddress seller_node_address = 14;
string offerer_payout_address_string = 15;
string maker_payout_address_string = 15;
string taker_payout_address_string = 16;
bytes offerer_btc_pub_key = 17;
bytes maker_btc_pub_key = 17;
bytes taker_btc_pub_key = 18;
}
@ -588,14 +588,14 @@ message FinalizePayoutTxRequest {
message PublishDepositTxRequest {
int32 message_version = 1;
string trade_id = 2;
PaymentAccountPayload offerer_payment_account_payload = 3;
string offerer_account_id = 4;
string offerer_contract_as_json = 5;
string offerer_contract_signature = 6;
string offerer_payout_address_string = 7;
PaymentAccountPayload maker_payment_account_payload = 3;
string maker_account_id = 4;
string maker_contract_as_json = 5;
string maker_contract_signature = 6;
string maker_payout_address_string = 7;
bytes prepared_deposit_tx = 8;
repeated RawTransactionInput offerer_inputs = 9;
bytes offerer_multi_sig_pub_key = 10;
repeated RawTransactionInput maker_inputs = 9;
bytes maker_multi_sig_pub_key = 10;
NodeAddress sender_node_address = 11;
string uid = 12;
}