Exemplo n.º 1
0
  void onSelectTrade(PendingTradesListItem item) {
    // clean up previous selectedItem
    selectedItem = item;

    if (item == null) {
      trade = null;
      tradeProperty.set(null);
    } else {
      trade = item.getTrade();
      tradeProperty.set(trade);

      isOfferer = tradeManager.isMyOffer(trade.getOffer());

      if (trade.getDepositTx() != null) txId.set(trade.getDepositTx().getHashAsString());
    }
  }
Exemplo n.º 2
0
  private void tryOpenDispute(boolean isSupportTicket) {
    if (trade != null) {
      Transaction depositTx = trade.getDepositTx();
      if (depositTx != null) {
        doOpenDispute(isSupportTicket, trade.getDepositTx());
      } else {
        log.warn("Trade.depositTx is null. We try to find the tx in our wallet.");
        List<Transaction> candidates = new ArrayList<>();
        List<Transaction> transactions = walletService.getWallet().getRecentTransactions(100, true);
        transactions
            .stream()
            .forEach(
                transaction -> {
                  Coin valueSentFromMe = transaction.getValueSentFromMe(walletService.getWallet());
                  if (!valueSentFromMe.isZero()) {
                    // spending tx
                    for (TransactionOutput transactionOutput : transaction.getOutputs()) {
                      if (!transactionOutput.isMine(walletService.getWallet())) {
                        if (transactionOutput.getScriptPubKey().isPayToScriptHash()) {
                          // MS tx
                          candidates.add(transaction);
                        }
                      }
                    }
                  }
                });

        if (candidates.size() == 1) doOpenDispute(isSupportTicket, candidates.get(0));
        else if (candidates.size() > 1)
          new SelectDepositTxPopup()
              .transactions(candidates)
              .onSelect(
                  transaction -> {
                    doOpenDispute(isSupportTicket, transaction);
                  })
              .closeButtonText("Cancel")
              .show();
        else log.error("Trade.depositTx is null and we did not find any MultiSig transaction.");
      }
    } else {
      log.error("Trade is null");
    }
  }