mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Do not use 0 btc outputs (#3725)
* Do not add an output if value is 0 BTC Fixes https://github.com/bisq-network/bisq/issues/3721 and https://github.com/bisq-network/bisq/issues/3722 There are still more issues as such a payout tx will cause that the trade ends up in failed trades. This commit only fixes the invalid tx issue. * Refactoring: Replace isGreaterThan(Coin.ZERO) with isPositive() * Do not display confirmation icon for 0 BTC tx If we do not get any BTC from a mediated payout tx we do not know about the confirmation state so it would stay always in the unconfirmed state. To avoid that confusion we prefer to hide the icon. This is a known issue from BitcoinJ but we have not found a solution for that yet.
This commit is contained in:
commit
77b2360698
2 changed files with 15 additions and 6 deletions
|
@ -926,10 +926,10 @@ public class TradeWalletService {
|
|||
TransactionOutput p2SHMultiSigOutput = depositTx.getOutput(0);
|
||||
Transaction payoutTx = new Transaction(params);
|
||||
payoutTx.addInput(p2SHMultiSigOutput);
|
||||
if (buyerPayoutAmount.isGreaterThan(Coin.ZERO)) {
|
||||
if (buyerPayoutAmount.isPositive()) {
|
||||
payoutTx.addOutput(buyerPayoutAmount, Address.fromBase58(params, buyerAddressString));
|
||||
}
|
||||
if (sellerPayoutAmount.isGreaterThan(Coin.ZERO)) {
|
||||
if (sellerPayoutAmount.isPositive()) {
|
||||
payoutTx.addOutput(sellerPayoutAmount, Address.fromBase58(params, sellerAddressString));
|
||||
}
|
||||
|
||||
|
@ -989,10 +989,10 @@ public class TradeWalletService {
|
|||
Sha256Hash spendTxHash = Sha256Hash.wrap(depositTxHex);
|
||||
payoutTx.addInput(new TransactionInput(params, depositTx, p2SHMultiSigOutputScript.getProgram(), new TransactionOutPoint(params, 0, spendTxHash), msOutput));
|
||||
|
||||
if (buyerPayoutAmount.isGreaterThan(Coin.ZERO)) {
|
||||
if (buyerPayoutAmount.isPositive()) {
|
||||
payoutTx.addOutput(buyerPayoutAmount, Address.fromBase58(params, buyerAddressString));
|
||||
}
|
||||
if (sellerPayoutAmount.isGreaterThan(Coin.ZERO)) {
|
||||
if (sellerPayoutAmount.isPositive()) {
|
||||
payoutTx.addOutput(sellerPayoutAmount, Address.fromBase58(params, sellerAddressString));
|
||||
}
|
||||
|
||||
|
@ -1135,8 +1135,13 @@ public class TradeWalletService {
|
|||
TransactionOutput p2SHMultiSigOutput = depositTx.getOutput(0);
|
||||
Transaction transaction = new Transaction(params);
|
||||
transaction.addInput(p2SHMultiSigOutput);
|
||||
if (buyerPayoutAmount.isPositive()) {
|
||||
transaction.addOutput(buyerPayoutAmount, Address.fromBase58(params, buyerAddressString));
|
||||
}
|
||||
if (sellerPayoutAmount.isPositive()) {
|
||||
transaction.addOutput(sellerPayoutAmount, Address.fromBase58(params, sellerAddressString));
|
||||
}
|
||||
checkArgument(transaction.getOutputs().size() >= 1, "We need at least one output.");
|
||||
return transaction;
|
||||
}
|
||||
|
||||
|
|
|
@ -223,6 +223,10 @@ class TransactionsListItem {
|
|||
} else if (trade.getPayoutTx() != null &&
|
||||
trade.getPayoutTx().getHashAsString().equals(txId)) {
|
||||
details = Res.get("funds.tx.multiSigPayout", tradeId);
|
||||
|
||||
if (amountAsCoin.isZero()) {
|
||||
txConfidenceIndicator.setVisible(false);
|
||||
}
|
||||
} else {
|
||||
Trade.DisputeState disputeState = trade.getDisputeState();
|
||||
if (disputeState == Trade.DisputeState.DISPUTE_CLOSED) {
|
||||
|
|
Loading…
Add table
Reference in a new issue