From 4a0302fbdfa0fa9d7add5242a48de48fd8b3c62f Mon Sep 17 00:00:00 2001 From: pokkst Date: Sun, 4 Dec 2022 12:47:12 -0600 Subject: [PATCH] Update version to 0.4.1.1 --- app/build.gradle | 4 ++-- .../net/mynero/wallet/service/MoneroHandlerThread.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3b14fcd..7efe01b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "net.mynero.wallet" minSdkVersion 21 targetSdkVersion 33 - versionCode 401 - versionName "0.4.1 'Fluorine Fermi'" + versionCode 40101 + versionName "0.4.1.1 'Fluorine Fermi'" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java index 7a21bc7..1b27134 100644 --- a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java +++ b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java @@ -158,14 +158,15 @@ public class MoneroHandlerThread extends Thread implements WalletListener { ArrayList newOutputs = new ArrayList<>(outputs); boolean donatePerTx = PrefService.getInstance().getBoolean(Constants.PREF_DONATE_PER_TX, false); if(donatePerTx && paymentId.isEmpty()) { // only attach donation when no payment id is needed (i.e. integrated address) + SecureRandom rand = new SecureRandom(); float randomDonatePct = getRandomDonateAmount(0.005f, 0.015f); // occasionally attaches a 0.5% to 1.5% donation. It is random so that not even I know how much exactly you are sending. /* It's also not entirely "per tx". It won't always attach it so as to not have a consistently uncommon fingerprint on-chain. When it does attach a donation, it will periodically split it up into multiple outputs instead of one. */ - int attachDonationRoll = new SecureRandom().nextInt(100); + int attachDonationRoll = rand.nextInt(100); if(attachDonationRoll > 90) { // 10% chance of being added - int splitDonationRoll = new SecureRandom().nextInt(100); + int splitDonationRoll = rand.nextInt(100); long donateAmount = (long) (amount*randomDonatePct); if(splitDonationRoll > 50) { // 50% chance of being split // split @@ -174,7 +175,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener { for(int i = 0; i < split; i++) { // TODO this can be expanded upon into the future to perform an auto-splitting/auto-churning for the user if their wallet is fresh and has few utxos. // randomly split between multiple wallets - int randomDonationAddress = new SecureRandom().nextInt(Constants.DONATION_ADDRESSES.length); + int randomDonationAddress = rand.nextInt(Constants.DONATION_ADDRESSES.length); String donationAddress = Constants.DONATION_ADDRESSES[randomDonationAddress]; newOutputs.add(new TransactionOutput(donationAddress, splitAmount)); } @@ -222,7 +223,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener { private int genRandomDonationSplit(int min, int max) { SecureRandom rand = new SecureRandom(); - return rand.nextInt() * (max - min) + min; + return rand.nextInt(max) + min; } public interface Listener {