diff --git a/index.php b/index.php index f30843d..0565d0c 100755 --- a/index.php +++ b/index.php @@ -23,12 +23,43 @@ $bal2 = $coin->getbalance("*", 0); $bal3 = abs($bal1 - $bal2); $bal4 = abs("{$y['stake']}"); -if($primary!=""){ - $address = $primary; + +$showMainAddressChangedMessage = false; +$oldAddress = $primary; +$newAddress; +// Fixes bug when the main address is set to an address not in the wallet ----------------------------------------------------- +if($primary != ""){ + $hasPrimary = false; + $addresses = $coin->getaddressesbyaccount(""); + + foreach($addresses as $add){ + if($add == $primary){ + $hasPrimary = true; + } + } + if ($hasPrimary) { + $address = $primary; + } else { + + $address = $coin->getaddressesbyaccount("")[0]; + + // Duplicated code from setPrimary, as we can't access the function ---------------- + $primaryLocation = "/home/stakebox/UI/primary".$currentWallet."address.php"; + // Open the file and erase the contents if any + $fp = fopen($primaryLocation, "w"); + // Write the data to the file + // CODE INJECTION WARNING! + fwrite($fp, ""); + // Close the file + fclose($fp); + $showMainAddressChangedMessage = true; + $newAddress = $address; + } } else{ - $address = $coin->getaddressesbyaccount("")[0]; + $address = $coin->getaddressesbyaccount("")[0]; } +//------------------------------------------------------------- if ($currentWallet == NavCoin){ $stakinginfo = $coin->getstakinginfo(); @@ -48,6 +79,22 @@ $fiatValue = number_format($fiatValue); ?>
+ +
+ Primary Address Updated:We detected your saved primary address was not owned by your wallet. It has been replaced with a valid address. +

This can occur when you restore your wallet after manually setting the primary address.

+ + New Address: \"{$address}\" +
Old Address: \"{$oldAddress}\" +
+
+
"; + + ?> +

Available Balance:

Unavailable Due To Staking:

diff --git a/libs/release_setup.sh b/libs/release_setup.sh index 2e4f067..0626fa7 100644 --- a/libs/release_setup.sh +++ b/libs/release_setup.sh @@ -2,7 +2,7 @@ LOG_FILE="/home/pi/release_log.txt" BOOTSTRAP_URL="https://build.nav.community/bootstrap/bootstrap-navcoin.tar" -VERSION="1.0.7" +VERSION="1.0.8" echo "WARNING THIS SCRIPT WILL DELETE YOUR WALLET.DAT. THERE IS NO WAY TO RECOVER YOUR COINS WITHOUT A BACK UP. THIS SCRIPT IS ONLY FOR USE WHEN CREATING NEW NAVPI IMAGES" echo "TO CONTINUE ENTER 'DELETE' OR ENTER ANYTHING ELSE TO EXIT"