Bitcoinj

如何使用 bitcoinj 獲得未結餘額?

  • July 23, 2015

我正在嘗試從錢包中獲取待處理餘額,但結果與待處理交易不匹配?謝謝你的建議!

編輯:我認為沒有辦法做到這一點,但這應該做同樣的事情:

// calculate balance, only include transactions that are not in a block
List<TransactionOutput> candidates = wallet.calculateAllSpendCandidates(false, false);
Coin value = Coin.ZERO;
for (TransactionOutput out : candidates) {
   if(out.getParentTransaction().getAppearsInHashes() == null) {
       // Not seen in any block that we know of
       value = value.add(out.getValue());
   }
}

引用自:https://bitcoin.stackexchange.com/questions/38744