mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Remove timeLock properties (WIP)
This commit is contained in:
parent
8e6c9cb3c5
commit
b6b7c44004
13 changed files with 83 additions and 72 deletions
|
@ -541,7 +541,6 @@ public class TradeWalletService {
|
|||
* @param buyerPayoutAddressString Address for buyer
|
||||
* @param sellerPayoutAddressString Address for seller
|
||||
* @param multiSigKeyPair DeterministicKey for MultiSig from seller
|
||||
* @param lockTime Lock time
|
||||
* @param buyerPubKey The public key of the buyer.
|
||||
* @param sellerPubKey The public key of the seller.
|
||||
* @param arbitratorPubKey The public key of the arbitrator.
|
||||
|
@ -549,13 +548,14 @@ public class TradeWalletService {
|
|||
* @throws AddressFormatException
|
||||
* @throws TransactionVerificationException
|
||||
*/
|
||||
//TODO: locktime
|
||||
public byte[] sellerSignsPayoutTx(Transaction depositTx,
|
||||
Coin buyerPayoutAmount,
|
||||
Coin sellerPayoutAmount,
|
||||
String buyerPayoutAddressString,
|
||||
String sellerPayoutAddressString,
|
||||
DeterministicKey multiSigKeyPair,
|
||||
long lockTime,
|
||||
/*long lockTime,*/
|
||||
byte[] buyerPubKey,
|
||||
byte[] sellerPubKey,
|
||||
byte[] arbitratorPubKey)
|
||||
|
@ -567,7 +567,7 @@ public class TradeWalletService {
|
|||
log.trace("buyerPayoutAddressString " + buyerPayoutAddressString);
|
||||
log.trace("sellerPayoutAddressString " + sellerPayoutAddressString);
|
||||
log.trace("multiSigKeyPair (not displayed for security reasons)");
|
||||
log.trace("lockTime " + lockTime);
|
||||
/* log.trace("lockTime " + lockTime);*/
|
||||
log.info("buyerPubKey " + ECKey.fromPublicOnly(buyerPubKey).toString());
|
||||
log.info("sellerPubKey " + ECKey.fromPublicOnly(sellerPubKey).toString());
|
||||
log.info("arbitratorPubKey " + ECKey.fromPublicOnly(arbitratorPubKey).toString());
|
||||
|
@ -575,8 +575,8 @@ public class TradeWalletService {
|
|||
buyerPayoutAmount,
|
||||
sellerPayoutAmount,
|
||||
buyerPayoutAddressString,
|
||||
sellerPayoutAddressString,
|
||||
lockTime
|
||||
sellerPayoutAddressString/*,
|
||||
lockTime*/
|
||||
);
|
||||
// MS redeemScript
|
||||
Script redeemScript = getMultiSigRedeemScript(buyerPubKey, sellerPubKey, arbitratorPubKey);
|
||||
|
@ -605,7 +605,6 @@ public class TradeWalletService {
|
|||
* @param buyerPayoutAddressString Address for buyer
|
||||
* @param sellerPayoutAddressString Address for seller
|
||||
* @param multiSigKeyPair Buyer's keypair for MultiSig
|
||||
* @param lockTime Lock time
|
||||
* @param buyerPubKey The public key of the buyer.
|
||||
* @param sellerPubKey The public key of the seller.
|
||||
* @param arbitratorPubKey The public key of the arbitrator.
|
||||
|
@ -614,6 +613,7 @@ public class TradeWalletService {
|
|||
* @throws TransactionVerificationException
|
||||
* @throws WalletException
|
||||
*/
|
||||
//TODO: locktime
|
||||
public Transaction buyerSignsAndFinalizesPayoutTx(Transaction depositTx,
|
||||
byte[] sellerSignature,
|
||||
Coin buyerPayoutAmount,
|
||||
|
@ -621,7 +621,7 @@ public class TradeWalletService {
|
|||
String buyerPayoutAddressString,
|
||||
String sellerPayoutAddressString,
|
||||
DeterministicKey multiSigKeyPair,
|
||||
long lockTime,
|
||||
/* long lockTime,*/
|
||||
byte[] buyerPubKey,
|
||||
byte[] sellerPubKey,
|
||||
byte[] arbitratorPubKey)
|
||||
|
@ -635,7 +635,7 @@ public class TradeWalletService {
|
|||
log.trace("buyerPayoutAddressString " + buyerPayoutAddressString);
|
||||
log.trace("sellerPayoutAddressString " + sellerPayoutAddressString);
|
||||
log.trace("multiSigKeyPair (not displayed for security reasons)");
|
||||
log.trace("lockTime " + lockTime);
|
||||
/*log.trace("lockTime " + lockTime);*/
|
||||
log.info("buyerPubKey " + ECKey.fromPublicOnly(buyerPubKey).toString());
|
||||
log.info("sellerPubKey " + ECKey.fromPublicOnly(sellerPubKey).toString());
|
||||
log.info("arbitratorPubKey " + ECKey.fromPublicOnly(arbitratorPubKey).toString());
|
||||
|
@ -644,8 +644,8 @@ public class TradeWalletService {
|
|||
buyerPayoutAmount,
|
||||
sellerPayoutAmount,
|
||||
buyerPayoutAddressString,
|
||||
sellerPayoutAddressString,
|
||||
lockTime);
|
||||
sellerPayoutAddressString/*,
|
||||
lockTime*/);
|
||||
// MS redeemScript
|
||||
Script redeemScript = getMultiSigRedeemScript(buyerPubKey, sellerPubKey, arbitratorPubKey);
|
||||
// MS output from prev. tx is index 0
|
||||
|
@ -995,6 +995,8 @@ public class TradeWalletService {
|
|||
return wallet.getLastBlockSeenHeight();
|
||||
}
|
||||
|
||||
//TODO: check transaction.getLockTime() ???
|
||||
//TODO: locktime
|
||||
public ListenableFuture<StoredBlock> getBlockHeightFuture(Transaction transaction) {
|
||||
checkNotNull(walletConfig);
|
||||
return walletConfig.chain().getHeightFuture((int) transaction.getLockTime());
|
||||
|
@ -1069,23 +1071,24 @@ public class TradeWalletService {
|
|||
return ScriptBuilder.createP2SHOutputScript(getMultiSigRedeemScript(buyerPubKey, sellerPubKey, arbitratorPubKey));
|
||||
}
|
||||
|
||||
//TODO: locktime
|
||||
private Transaction createPayoutTx(Transaction depositTx,
|
||||
Coin buyerPayoutAmount,
|
||||
Coin sellerPayoutAmount,
|
||||
String buyerAddressString,
|
||||
String sellerAddressString,
|
||||
long lockTime) throws AddressFormatException {
|
||||
String sellerAddressString/*,
|
||||
long lockTime*/) throws AddressFormatException {
|
||||
TransactionOutput p2SHMultiSigOutput = depositTx.getOutput(0);
|
||||
Transaction transaction = new Transaction(params);
|
||||
transaction.addInput(p2SHMultiSigOutput);
|
||||
transaction.addOutput(buyerPayoutAmount, new Address(params, buyerAddressString));
|
||||
transaction.addOutput(sellerPayoutAmount, new Address(params, sellerAddressString));
|
||||
if (lockTime != 0) {
|
||||
/*if (lockTime != 0) {
|
||||
log.debug("We use a lockTime of " + lockTime);
|
||||
// When using lockTime we need to set sequenceNumber to 0
|
||||
transaction.getInputs().stream().forEach(i -> i.setSequenceNumber(0));
|
||||
transaction.setLockTime(lockTime);
|
||||
}
|
||||
}*/
|
||||
return transaction;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,8 @@ public abstract class Trade implements Tradable, Model {
|
|||
private String takerContractSignature;
|
||||
private String offererContractSignature;
|
||||
private Transaction payoutTx;
|
||||
private long lockTimeAsBlockHeight;
|
||||
//TODO: locktime
|
||||
// private long lockTimeAsBlockHeight;
|
||||
private NodeAddress arbitratorNodeAddress;
|
||||
private byte[] arbitratorBtcPubKey;
|
||||
private String takerPaymentAccountId;
|
||||
|
@ -505,14 +506,14 @@ public abstract class Trade implements Tradable, Model {
|
|||
return takeOfferFee;
|
||||
}
|
||||
|
||||
|
||||
public void setLockTimeAsBlockHeight(long lockTimeAsBlockHeight) {
|
||||
//TODO: locktime
|
||||
/* public void setLockTimeAsBlockHeight(long lockTimeAsBlockHeight) {
|
||||
this.lockTimeAsBlockHeight = lockTimeAsBlockHeight;
|
||||
}
|
||||
|
||||
public long getLockTimeAsBlockHeight() {
|
||||
return lockTimeAsBlockHeight;
|
||||
}
|
||||
}*/
|
||||
|
||||
public void setTakerContractSignature(String takerSignature) {
|
||||
this.takerContractSignature = takerSignature;
|
||||
|
@ -681,10 +682,12 @@ public abstract class Trade implements Tradable, Model {
|
|||
"\n\tdepositTx=" + depositTx +
|
||||
"\n\ttakeOfferFeeTxId=" + takeOfferFeeTxId +
|
||||
"\n\tcontract=" + contract +
|
||||
"\n\ttakerContractSignature.hashCode()='" + (takerContractSignature != null ? takerContractSignature.hashCode() : "") + '\'' +
|
||||
"\n\toffererContractSignature.hashCode()='" + (offererContractSignature != null ? offererContractSignature.hashCode() : "") + '\'' +
|
||||
"\n\ttakerContractSignature.hashCode()='" + (takerContractSignature != null ?
|
||||
takerContractSignature.hashCode() : "") + '\'' +
|
||||
"\n\toffererContractSignature.hashCode()='" + (offererContractSignature != null ?
|
||||
offererContractSignature.hashCode() : "") + '\'' +
|
||||
"\n\tpayoutTx=" + payoutTx +
|
||||
"\n\tlockTimeAsBlockHeight=" + lockTimeAsBlockHeight +
|
||||
/* "\n\tlockTimeAsBlockHeight=" + lockTimeAsBlockHeight +*/
|
||||
"\n\tarbitratorNodeAddress=" + arbitratorNodeAddress +
|
||||
"\n\ttakerPaymentAccountId='" + takerPaymentAccountId + '\'' +
|
||||
"\n\ttxFee='" + txFee.toFriendlyString() + '\'' +
|
||||
|
|
|
@ -46,7 +46,9 @@ public class ProcessFinalizePayoutTxRequest extends TradeTask {
|
|||
|
||||
processModel.tradingPeer.setSignature(checkNotNull(message.sellerSignature));
|
||||
processModel.tradingPeer.setPayoutAddressString(Validator.nonEmptyStringOf(message.sellerPayoutAddress));
|
||||
trade.setLockTimeAsBlockHeight(Validator.nonNegativeLongOf(message.lockTimeAsBlockHeight));
|
||||
|
||||
//TODO: locktime
|
||||
// trade.setLockTimeAsBlockHeight(Validator.nonNegativeLongOf(message.lockTimeAsBlockHeight));
|
||||
|
||||
// update to the latest peer address of our peer if the message is correct
|
||||
trade.setTradingPeerNodeAddress(processModel.getTempTradingPeerNodeAddress());
|
||||
|
|
|
@ -55,6 +55,7 @@ public class SignAndFinalizePayoutTx extends TradeTask {
|
|||
byte[] buyerMultiSigPubKey = processModel.getMyMultiSigPubKey();
|
||||
DeterministicKey multiSigKeyPair = walletService.getMultiSigKeyPair(id, buyerMultiSigPubKey);
|
||||
TradingPeer tradingPeer = processModel.tradingPeer;
|
||||
//TODO: locktime
|
||||
Transaction transaction = processModel.getTradeWalletService().buyerSignsAndFinalizesPayoutTx(
|
||||
trade.getDepositTx(),
|
||||
tradingPeer.getSignature(),
|
||||
|
@ -63,7 +64,7 @@ public class SignAndFinalizePayoutTx extends TradeTask {
|
|||
buyerPayoutAddressString,
|
||||
tradingPeer.getPayoutAddressString(),
|
||||
multiSigKeyPair,
|
||||
trade.getLockTimeAsBlockHeight(),
|
||||
/* trade.getLockTimeAsBlockHeight(),*/
|
||||
buyerMultiSigPubKey,
|
||||
tradingPeer.getMultiSigPubKey(),
|
||||
trade.getArbitratorPubKey()
|
||||
|
|
|
@ -38,6 +38,7 @@ public class SendFinalizePayoutTxRequest extends TradeTask {
|
|||
@Override
|
||||
protected void run() {
|
||||
try {
|
||||
//TODO: locktime
|
||||
runInterceptHook();
|
||||
if (trade.getTradingPeerNodeAddress() != null) {
|
||||
BtcWalletService walletService = processModel.getWalletService();
|
||||
|
@ -46,7 +47,7 @@ public class SendFinalizePayoutTxRequest extends TradeTask {
|
|||
processModel.getId(),
|
||||
processModel.getPayoutTxSignature(),
|
||||
sellerPayoutAddress,
|
||||
trade.getLockTimeAsBlockHeight(),
|
||||
/* trade.getLockTimeAsBlockHeight(),*/
|
||||
processModel.getMyNodeAddress()
|
||||
);
|
||||
|
||||
|
|
|
@ -51,15 +51,17 @@ public class SignPayoutTx extends TradeTask {
|
|||
Coin buyerPayoutAmount = trade.getOffer().getBuyerSecurityDeposit()
|
||||
.add(trade.getTradeAmount());
|
||||
|
||||
|
||||
//TODO: locktime
|
||||
// We use the sellers LastBlockSeenHeight, which might be different to the buyers one.
|
||||
// If lock time is 0 we set lockTimeAsBlockHeight to 0 to mark it as "not set".
|
||||
// In the tradeWallet we apply the lockTime only if it is set, otherwise we use the default values for
|
||||
// transaction lockTime and sequence number
|
||||
long lockTime = trade.getOffer().getPaymentMethod().getLockTime();
|
||||
/* long lockTime = trade.getOffer().getPaymentMethod().getLockTime();
|
||||
long lockTimeAsBlockHeight = 0;
|
||||
if (lockTime > 0)
|
||||
lockTimeAsBlockHeight = processModel.getTradeWalletService().getLastBlockSeenHeight() + lockTime;
|
||||
trade.setLockTimeAsBlockHeight(lockTimeAsBlockHeight);
|
||||
trade.setLockTimeAsBlockHeight(lockTimeAsBlockHeight);*/
|
||||
|
||||
BtcWalletService walletService = processModel.getWalletService();
|
||||
String id = processModel.getOffer().getId();
|
||||
|
@ -77,7 +79,7 @@ public class SignPayoutTx extends TradeTask {
|
|||
processModel.tradingPeer.getPayoutAddressString(),
|
||||
sellerPayoutAddressString,
|
||||
multiSigKeyPair,
|
||||
lockTimeAsBlockHeight,
|
||||
/* lockTimeAsBlockHeight,*/
|
||||
processModel.tradingPeer.getMultiSigPubKey(),
|
||||
sellerMultiSigPubKey,
|
||||
trade.getArbitratorPubKey());
|
||||
|
|
|
@ -18,21 +18,16 @@
|
|||
package io.bisq.core.trade.protocol.tasks.shared;
|
||||
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.app.Log;
|
||||
import io.bisq.common.taskrunner.TaskRunner;
|
||||
import io.bisq.core.trade.Trade;
|
||||
import io.bisq.core.trade.protocol.tasks.TradeTask;
|
||||
import org.bitcoinj.core.StoredBlock;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.TransactionConfidence;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BroadcastAfterLockTime extends TradeTask {
|
||||
|
@ -46,11 +41,13 @@ public class BroadcastAfterLockTime extends TradeTask {
|
|||
@Override
|
||||
protected void run() {
|
||||
try {
|
||||
//TODO: locktime
|
||||
runInterceptHook();
|
||||
log.debug("ChainHeight/LockTime: {} / {}", processModel.getTradeWalletService().getBestChainHeight(), trade.getLockTimeAsBlockHeight());
|
||||
if (trade.getLockTimeAsBlockHeight() == 0 || processModel.getTradeWalletService().getBestChainHeight() >= trade.getLockTimeAsBlockHeight()) {
|
||||
/*log.debug("ChainHeight/LockTime: {} / {}", processModel.getTradeWalletService().getBestChainHeight(), trade.getLockTimeAsBlockHeight());*/
|
||||
// if (trade.getLockTimeAsBlockHeight() == 0 /*||
|
||||
// processModel.getTradeWalletService().getBestChainHeight() >= trade.getLockTimeAsBlockHeight()) {
|
||||
broadcastTx();
|
||||
} else {
|
||||
/* } else {
|
||||
ListenableFuture<StoredBlock> blockHeightFuture = processModel.getTradeWalletService().getBlockHeightFuture(trade.getPayoutTx());
|
||||
blockHeightFuture.addListener(
|
||||
() -> {
|
||||
|
@ -64,7 +61,7 @@ public class BroadcastAfterLockTime extends TradeTask {
|
|||
broadcastTx();
|
||||
},
|
||||
UserThread::execute);
|
||||
}
|
||||
}*/
|
||||
} catch (Throwable t) {
|
||||
failed(t);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
|
||||
// If id is empty string we ignore filter (display all methods)
|
||||
|
||||
PaymentMethod selectedPaymentMethod = new PaymentMethod(GUIUtil.SHOW_ALL_FLAG, 0, 0, null);
|
||||
PaymentMethod selectedPaymentMethod = new PaymentMethod(GUIUtil.SHOW_ALL_FLAG, 0, null);
|
||||
|
||||
private final ObservableList<OfferBookListItem> offerBookListItems;
|
||||
private boolean isTabSelected;
|
||||
|
@ -258,7 +258,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
|
||||
ObservableList<PaymentMethod> getPaymentMethods() {
|
||||
ObservableList<PaymentMethod> list = FXCollections.observableArrayList(PaymentMethod.ALL_VALUES);
|
||||
list.add(0, new PaymentMethod(GUIUtil.SHOW_ALL_FLAG, 0, 0, null));
|
||||
list.add(0, new PaymentMethod(GUIUtil.SHOW_ALL_FLAG, 0, null));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,8 +256,9 @@ public class PendingTradesDataModel extends ActivatableDataModel {
|
|||
tradeWalletService.removeBlockChainListener(blockChainListener);
|
||||
}
|
||||
|
||||
//TODO: locktime
|
||||
public long getLockTime() {
|
||||
return getTrade() != null ? getTrade().getLockTimeAsBlockHeight() : 0;
|
||||
return /*getTrade() != null ? getTrade().getLockTimeAsBlockHeight() :*/ 0;
|
||||
}
|
||||
|
||||
public int getBestChainHeight() {
|
||||
|
|
|
@ -503,10 +503,11 @@ public class ProtoBufferUtilities {
|
|||
disputeCommunicationMessage.getArrived(), disputeCommunicationMessage.getStoredInMailbox());
|
||||
}
|
||||
|
||||
//TODO: locktime
|
||||
private static Message getFinalizePayoutTxRequest(PB.FinalizePayoutTxRequest finalizePayoutTxRequest) {
|
||||
return new FinalizePayoutTxRequest(finalizePayoutTxRequest.getTradeId(),
|
||||
finalizePayoutTxRequest.getSellerSignature().toByteArray(),
|
||||
finalizePayoutTxRequest.getSellerPayoutAddress(), finalizePayoutTxRequest.getLockTimeAsBlockHeight(),
|
||||
finalizePayoutTxRequest.getSellerPayoutAddress(), /*finalizePayoutTxRequest.getLockTimeAsBlockHeight(),*/
|
||||
getNodeAddress(finalizePayoutTxRequest.getSenderNodeAddress()));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,29 +35,30 @@ public final class FinalizePayoutTxRequest extends TradeMessage implements Mailb
|
|||
|
||||
public final byte[] sellerSignature;
|
||||
public final String sellerPayoutAddress;
|
||||
public final long lockTimeAsBlockHeight;
|
||||
/* public final long lockTimeAsBlockHeight;*/
|
||||
private final NodeAddress senderNodeAddress;
|
||||
private final String uid;
|
||||
|
||||
//TODO: locktime
|
||||
public FinalizePayoutTxRequest(String tradeId,
|
||||
byte[] sellerSignature,
|
||||
String sellerPayoutAddress,
|
||||
long lockTimeAsBlockHeight,
|
||||
/*long lockTimeAsBlockHeight,*/
|
||||
NodeAddress senderNodeAddress) {
|
||||
this(tradeId, sellerSignature, sellerPayoutAddress, lockTimeAsBlockHeight, senderNodeAddress,
|
||||
this(tradeId, sellerSignature, sellerPayoutAddress,/* lockTimeAsBlockHeight, */senderNodeAddress,
|
||||
UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
public FinalizePayoutTxRequest(String tradeId,
|
||||
byte[] sellerSignature,
|
||||
String sellerPayoutAddress,
|
||||
long lockTimeAsBlockHeight,
|
||||
/* long lockTimeAsBlockHeight,*/
|
||||
NodeAddress senderNodeAddress,
|
||||
String uid) {
|
||||
super(tradeId);
|
||||
this.sellerSignature = sellerSignature;
|
||||
this.sellerPayoutAddress = sellerPayoutAddress;
|
||||
this.lockTimeAsBlockHeight = lockTimeAsBlockHeight;
|
||||
// this.lockTimeAsBlockHeight = lockTimeAsBlockHeight;
|
||||
this.senderNodeAddress = senderNodeAddress;
|
||||
this.uid = uid;
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ public final class FinalizePayoutTxRequest extends TradeMessage implements Mailb
|
|||
|
||||
FinalizePayoutTxRequest that = (FinalizePayoutTxRequest) o;
|
||||
|
||||
if (lockTimeAsBlockHeight != that.lockTimeAsBlockHeight) return false;
|
||||
// if (lockTimeAsBlockHeight != that.lockTimeAsBlockHeight) return false;
|
||||
if (!Arrays.equals(sellerSignature, that.sellerSignature)) return false;
|
||||
if (sellerPayoutAddress != null ? !sellerPayoutAddress.equals(that.sellerPayoutAddress) : that.sellerPayoutAddress != null)
|
||||
return false;
|
||||
|
@ -95,7 +96,7 @@ public final class FinalizePayoutTxRequest extends TradeMessage implements Mailb
|
|||
int result = super.hashCode();
|
||||
result = 31 * result + (sellerSignature != null ? Arrays.hashCode(sellerSignature) : 0);
|
||||
result = 31 * result + (sellerPayoutAddress != null ? sellerPayoutAddress.hashCode() : 0);
|
||||
result = 31 * result + (int) (lockTimeAsBlockHeight ^ (lockTimeAsBlockHeight >>> 32));
|
||||
// result = 31 * result + (int) (lockTimeAsBlockHeight ^ (lockTimeAsBlockHeight >>> 32));
|
||||
result = 31 * result + (senderNodeAddress != null ? senderNodeAddress.hashCode() : 0);
|
||||
result = 31 * result + (uid != null ? uid.hashCode() : 0);
|
||||
return result;
|
||||
|
@ -109,7 +110,7 @@ public final class FinalizePayoutTxRequest extends TradeMessage implements Mailb
|
|||
.setTradeId(tradeId)
|
||||
.setSellerSignature(ByteString.copyFrom(sellerSignature))
|
||||
.setSellerPayoutAddress(sellerPayoutAddress)
|
||||
.setLockTimeAsBlockHeight(lockTimeAsBlockHeight)
|
||||
/* .setLockTimeAsBlockHeight(lockTimeAsBlockHeight)*/
|
||||
.setSenderNodeAddress(senderNodeAddress.toProto())
|
||||
.setUid(uid)).build();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.Optional;
|
|||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
//TODO: locktime
|
||||
public final class PaymentMethod implements Persistable, Comparable {
|
||||
// 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;
|
||||
|
@ -80,57 +81,56 @@ public final class PaymentMethod implements Persistable, Comparable {
|
|||
|
||||
public static final List<PaymentMethod> ALL_VALUES = new ArrayList<>(Arrays.asList(
|
||||
// EUR
|
||||
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY, Coin.parseCoin("0.5")),
|
||||
SEPA = new PaymentMethod(SEPA_ID, 8 * DAY, Coin.parseCoin("0.5")),
|
||||
// sepa takes 1-3 business days. We use 8 days to include safety for holidays
|
||||
|
||||
// Global
|
||||
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
SAME_BANK = new PaymentMethod(SAME_BANK_ID, 0, 2 * DAY, Coin.parseCoin("0.5")),
|
||||
SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
SAME_BANK = new PaymentMethod(SAME_BANK_ID, 2 * DAY, Coin.parseCoin("0.5")),
|
||||
SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
CASH_DEPOSIT = new PaymentMethod(CASH_DEPOSIT_ID, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
|
||||
// Trans national
|
||||
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
OK_PAY = new PaymentMethod(OK_PAY_ID, DAY, Coin.parseCoin("1")),
|
||||
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, DAY, Coin.parseCoin("1")),
|
||||
|
||||
// UK
|
||||
FASTER_PAYMENTS = new PaymentMethod(FASTER_PAYMENTS_ID, 0, DAY, Coin.parseCoin("0.5")),
|
||||
FASTER_PAYMENTS = new PaymentMethod(FASTER_PAYMENTS_ID, DAY, Coin.parseCoin("0.5")),
|
||||
|
||||
// Canada
|
||||
INTERAC_E_TRANSFER = new PaymentMethod(INTERAC_E_TRANSFER_ID, 0, DAY, Coin.parseCoin("0.5")),
|
||||
INTERAC_E_TRANSFER = new PaymentMethod(INTERAC_E_TRANSFER_ID, DAY, Coin.parseCoin("0.5")),
|
||||
|
||||
// US
|
||||
CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 0, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
CHASE_QUICK_PAY = new PaymentMethod(CHASE_QUICK_PAY_ID, 0, DAY, Coin.parseCoin("0.5")),
|
||||
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 0, 8 * DAY, Coin.parseCoin("0.5")),
|
||||
CLEAR_X_CHANGE = new PaymentMethod(CLEAR_X_CHANGE_ID, 4 * DAY, Coin.parseCoin("0.5")),
|
||||
CHASE_QUICK_PAY = new PaymentMethod(CHASE_QUICK_PAY_ID, DAY, Coin.parseCoin("0.5")),
|
||||
US_POSTAL_MONEY_ORDER = new PaymentMethod(US_POSTAL_MONEY_ORDER_ID, 8 * DAY, Coin.parseCoin("0.5")),
|
||||
|
||||
// Sweden
|
||||
SWISH = new PaymentMethod(SWISH_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
SWISH = new PaymentMethod(SWISH_ID, DAY, Coin.parseCoin("1")),
|
||||
|
||||
// China
|
||||
ALI_PAY = new PaymentMethod(ALI_PAY_ID, 0, DAY, Coin.parseCoin("1")),
|
||||
ALI_PAY = new PaymentMethod(ALI_PAY_ID, DAY, Coin.parseCoin("1")),
|
||||
|
||||
// Altcoins
|
||||
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, 0, DAY, Coin.parseCoin("1"))
|
||||
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, DAY, Coin.parseCoin("1"))
|
||||
));
|
||||
|
||||
private final String id;
|
||||
private long lockTime;
|
||||
// private long lockTime;
|
||||
private long maxTradePeriod;
|
||||
private Coin maxTradeLimit;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param lockTime lock time when seller release BTC until the payout tx gets valid (bitcoin tx lockTime). Serves as protection
|
||||
* against charge back risk. If Bank do the charge back quickly the Arbitrator and the seller can push another
|
||||
* double spend tx to invalidate the time locked payout tx. For the moment we set all to 0 but will have it in
|
||||
* place when needed.
|
||||
* @param maxTradePeriod The min. period a trader need to wait until he gets displayed the contact form for opening a dispute.
|
||||
* @param maxTradeLimit The max. allowed trade amount in Bitcoin for that payment method (depending on charge back risk)
|
||||
*/
|
||||
public PaymentMethod(String id, long lockTime, long maxTradePeriod, Coin maxTradeLimit) {
|
||||
public PaymentMethod(String id,/* long lockTime,*/ long maxTradePeriod, Coin maxTradeLimit) {
|
||||
this.id = id;
|
||||
this.lockTime = lockTime;
|
||||
// this.lockTime = lockTime;
|
||||
this.maxTradePeriod = maxTradePeriod;
|
||||
this.maxTradeLimit = maxTradeLimit;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public final class PaymentMethod implements Persistable, Comparable {
|
|||
|
||||
// In case we update those values we want that the persisted accounts get updated as well
|
||||
PaymentMethod paymentMethod = PaymentMethod.getPaymentMethodById(id);
|
||||
this.lockTime = paymentMethod.getLockTime();
|
||||
// this.lockTime = paymentMethod.getLockTime();
|
||||
this.maxTradePeriod = paymentMethod.getMaxTradePeriod();
|
||||
this.maxTradeLimit = paymentMethod.getMaxTradeLimit();
|
||||
} catch (Throwable t) {
|
||||
|
@ -154,7 +154,7 @@ public final class PaymentMethod implements Persistable, Comparable {
|
|||
if (paymentMethodOptional.isPresent())
|
||||
return paymentMethodOptional.get();
|
||||
else
|
||||
return new PaymentMethod(Res.get("shared.na"), 1, DAY, Coin.parseCoin("0"));
|
||||
return new PaymentMethod(Res.get("shared.na"), DAY, Coin.parseCoin("0"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -579,9 +579,8 @@ message FinalizePayoutTxRequest {
|
|||
string trade_id = 2;
|
||||
bytes seller_signature = 3;
|
||||
string seller_payout_address = 4;
|
||||
int64 lock_time_as_block_height = 5;
|
||||
NodeAddress sender_node_address = 6;
|
||||
string uid = 7;
|
||||
NodeAddress sender_node_address = 5;
|
||||
string uid = 6;
|
||||
}
|
||||
|
||||
message PublishDepositTxRequest {
|
||||
|
|
Loading…
Add table
Reference in a new issue