mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-25 08:52:28 +00:00
Add code comments
This commit is contained in:
parent
55621e3465
commit
95d5b78542
2 changed files with 5 additions and 1 deletions
|
@ -125,6 +125,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||
long amount = sendAll ? Wallet.SWEEP_ALL : Wallet.getAmountFromString(amountStr);
|
||||
ArrayList<String> preferredInputs;
|
||||
if(selectedUtxos.isEmpty()) {
|
||||
// no inputs manually selected, we are sending from home screen most likely, or user somehow broke the app
|
||||
preferredInputs = UTXOService.getInstance().selectUtxos(amount, sendAll);
|
||||
} else {
|
||||
preferredInputs = selectedUtxos;
|
||||
|
|
|
@ -39,12 +39,15 @@ public class UTXOService extends ServiceBase {
|
|||
List<CoinsInfo> utxos = getUtxos();
|
||||
long amountSelected = 0;
|
||||
Collections.shuffle(utxos);
|
||||
//loop through each utxo
|
||||
for (CoinsInfo coinsInfo : utxos) {
|
||||
if(!coinsInfo.isSpent()) {
|
||||
if(!coinsInfo.isSpent()) { //filter out spent outputs
|
||||
if (sendAll) {
|
||||
// if send all, add all utxos and set amount to send all
|
||||
selectedUtxos.add(coinsInfo.getKeyImage());
|
||||
amountSelected = Wallet.SWEEP_ALL;
|
||||
} else {
|
||||
//if amount selected is still less than amount needed, and the utxos tx hash hasn't already been seen, add utxo
|
||||
if (amountSelected <= amount && !seenTxs.contains(coinsInfo.getHash())) {
|
||||
selectedUtxos.add(coinsInfo.getKeyImage());
|
||||
// we don't want to spend multiple utxos from the same transaction, so we prevent that from happening here.
|
||||
|
|
Loading…
Reference in a new issue