mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-09-19 19:06:18 +02:00
Add code comments
This commit is contained in:
parent
55621e3465
commit
95d5b78542
@ -125,6 +125,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||||||
long amount = sendAll ? Wallet.SWEEP_ALL : Wallet.getAmountFromString(amountStr);
|
long amount = sendAll ? Wallet.SWEEP_ALL : Wallet.getAmountFromString(amountStr);
|
||||||
ArrayList<String> preferredInputs;
|
ArrayList<String> preferredInputs;
|
||||||
if(selectedUtxos.isEmpty()) {
|
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);
|
preferredInputs = UTXOService.getInstance().selectUtxos(amount, sendAll);
|
||||||
} else {
|
} else {
|
||||||
preferredInputs = selectedUtxos;
|
preferredInputs = selectedUtxos;
|
||||||
|
@ -39,12 +39,15 @@ public class UTXOService extends ServiceBase {
|
|||||||
List<CoinsInfo> utxos = getUtxos();
|
List<CoinsInfo> utxos = getUtxos();
|
||||||
long amountSelected = 0;
|
long amountSelected = 0;
|
||||||
Collections.shuffle(utxos);
|
Collections.shuffle(utxos);
|
||||||
|
//loop through each utxo
|
||||||
for (CoinsInfo coinsInfo : utxos) {
|
for (CoinsInfo coinsInfo : utxos) {
|
||||||
if(!coinsInfo.isSpent()) {
|
if(!coinsInfo.isSpent()) { //filter out spent outputs
|
||||||
if (sendAll) {
|
if (sendAll) {
|
||||||
|
// if send all, add all utxos and set amount to send all
|
||||||
selectedUtxos.add(coinsInfo.getKeyImage());
|
selectedUtxos.add(coinsInfo.getKeyImage());
|
||||||
amountSelected = Wallet.SWEEP_ALL;
|
amountSelected = Wallet.SWEEP_ALL;
|
||||||
} else {
|
} 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())) {
|
if (amountSelected <= amount && !seenTxs.contains(coinsInfo.getHash())) {
|
||||||
selectedUtxos.add(coinsInfo.getKeyImage());
|
selectedUtxos.add(coinsInfo.getKeyImage());
|
||||||
// we don't want to spend multiple utxos from the same transaction, so we prevent that from happening here.
|
// we don't want to spend multiple utxos from the same transaction, so we prevent that from happening here.
|
||||||
|
Loading…
Reference in New Issue
Block a user