mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
WalletTool: simplify coinSelector lambdas
This commit is contained in:
parent
853aeebd81
commit
e186ef9c84
1 changed files with 4 additions and 7 deletions
|
@ -445,8 +445,7 @@ public class WalletTool implements Callable<Integer> {
|
|||
final Address validSelectAddr = selectAddr;
|
||||
coinSelector = CoinSelector.fromPredicate(candidate -> {
|
||||
try {
|
||||
Address candidateAddr = candidate.getScriptPubKey().getToAddress(net);
|
||||
return validSelectAddr.equals(candidateAddr);
|
||||
return candidate.getScriptPubKey().getToAddress(net).equals(validSelectAddr);
|
||||
} catch (ScriptException x) {
|
||||
return false;
|
||||
}
|
||||
|
@ -456,11 +455,9 @@ public class WalletTool implements Callable<Integer> {
|
|||
String[] parts = selectOutputStr.split(":", 2);
|
||||
Sha256Hash selectTransactionHash = Sha256Hash.wrap(parts[0]);
|
||||
int selectIndex = Integer.parseInt(parts[1]);
|
||||
coinSelector = CoinSelector.fromPredicate(candidate -> {
|
||||
int candidateIndex = candidate.getIndex();
|
||||
Sha256Hash candidateTransactionHash = candidate.getParentTransactionHash();
|
||||
return selectIndex == candidateIndex && selectTransactionHash.equals(candidateTransactionHash);
|
||||
});
|
||||
coinSelector = CoinSelector.fromPredicate(candidate ->
|
||||
candidate.getIndex() == selectIndex && candidate.getParentTransactionHash().equals(selectTransactionHash)
|
||||
);
|
||||
}
|
||||
send(coinSelector, outputsStr, feePerVkb, lockTimeStr, allowUnconfirmed);
|
||||
} else if (paymentRequestLocationStr != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue