mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 23:03:04 +00:00
Make it easier for people to override just the tx eligibility behavior in DefaultCoinSelector by using a protected method.
This commit is contained in:
parent
aaa2ec4c5a
commit
732c5e631e
@ -257,7 +257,7 @@ public class Wallet implements Serializable, BlockChainListener {
|
||||
for (TransactionOutput output : sortedOutputs) {
|
||||
if (total >= target) break;
|
||||
// Only pick chain-included transactions, or transactions that are ours and pending.
|
||||
if (!isSelectable(output.parentTransaction)) continue;
|
||||
if (!shouldSelect(output.parentTransaction)) continue;
|
||||
selected.add(output);
|
||||
total += output.getValue().longValue();
|
||||
}
|
||||
@ -266,6 +266,11 @@ public class Wallet implements Serializable, BlockChainListener {
|
||||
return new CoinSelection(BigInteger.valueOf(total), selected);
|
||||
}
|
||||
|
||||
/** Sub-classes can override this to just customize whether transactions are usable, but keep age sorting. */
|
||||
protected boolean shouldSelect(Transaction tx) {
|
||||
return isSelectable(tx);
|
||||
}
|
||||
|
||||
public static boolean isSelectable(Transaction tx) {
|
||||
// Only pick chain-included transactions, or transactions that are ours and pending.
|
||||
TransactionConfidence confidence = tx.getConfidence();
|
||||
@ -1686,6 +1691,7 @@ public class Wallet implements Serializable, BlockChainListener {
|
||||
/**
|
||||
* The AES key to use to decrypt the private keys before signing.
|
||||
* If null then no decryption will be performed and if decryption is required an exception will be thrown.
|
||||
* You can get this from a password by doing wallet.getKeyCrypter().derivePassword(password).
|
||||
*/
|
||||
public KeyParameter aesKey = null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user