Skip to content

Commit

Permalink
Fix unititialized booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino committed Feb 18, 2024
1 parent 9a60dd8 commit 1021b81
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/qt/pivx/addresseswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void AddressesWidget::onStoreContactClicked()
QString label = ui->lineEditName->text();
QString address = ui->lineEditAddress->text();

bool isStaking, isExchange, isShield = false;
bool isStaking = false, isExchange = false, isShield = false;
auto pivAdd = Standard::DecodeDestination(address.toUtf8().constData(), isStaking, isExchange, isShield);

if (!Standard::IsValidDestination(pivAdd)) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ void SendWidget::onContactMultiClicked()
return;
}

bool isStaking, isExchange, isShielded = false;
bool isStaking = false, isExchange = false, isShielded = false;
auto pivAdd = Standard::DecodeDestination(address.toStdString(), isStaking, isExchange, isShielded);

if (!Standard::IsValidDestination(pivAdd) || isStaking) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/sendchangeaddressdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void SendChangeAddressDialog::accept()
QDialog::accept();
} else {
// validate address
bool isStaking, isExchange, isShielded = false;
bool isStaking = false, isExchange = false, isShielded = false;
dest = Standard::DecodeDestination(ui->lineEditAddress->text().toStdString(), isStaking, isExchange, isShielded);

if (!Standard::IsValidDestination(dest)) {
Expand Down
10 changes: 5 additions & 5 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
bool WalletModel::validateAddress(const QString& address)
{
// Only regular base58 addresses and shielded addresses accepted here
bool isStaking, isExchange = false;
bool isStaking = false, isExchange = false;
CWDestination dest = Standard::DecodeDestination(address.toStdString(), isStaking, isExchange);
const auto regDest = boost::get<CTxDestination>(&dest);
if (regDest && IsValidDestination(*regDest) && isStaking) return false;
Expand All @@ -413,7 +413,7 @@ bool WalletModel::validateAddress(const QString& address, bool fStaking)

bool WalletModel::validateAddress(const QString& address, bool fStaking, bool& isShielded)
{
bool isStaking, isExchange = false;
bool isStaking = false, isExchange = false;
CWDestination dest = Standard::DecodeDestination(address.toStdString(), isStaking, isExchange);
if (IsShieldedDestination(dest)) {
isShielded = true;
Expand Down Expand Up @@ -596,7 +596,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction& tran
for (const SendCoinsRecipient& rcp : transaction.getRecipients()) {
// Don't touch the address book when we have a payment request
{
bool isStaking, isExchange, isShielded = false;
bool isStaking = false, isExchange = false, isShielded = false;
auto address = Standard::DecodeDestination(rcp.address.toStdString(), isStaking, isExchange, isShielded);
std::string purpose = isShielded ? AddressBook::AddressBookPurpose::SHIELDED_SEND :
isStaking ? AddressBook::AddressBookPurpose::COLD_STAKING_SEND : AddressBook::AddressBookPurpose::SEND;
Expand Down Expand Up @@ -942,7 +942,7 @@ int64_t WalletModel::getKeyCreationTime(const CTxDestination& address)

int64_t WalletModel::getKeyCreationTime(const std::string& address)
{
bool isStaking, isExchange, isShielded = false;
bool isStaking = false, isExchange = false, isShielded = false;
return wallet->GetKeyCreationTime(Standard::DecodeDestination(address, isStaking, isExchange, isShielded));
}

Expand Down Expand Up @@ -985,7 +985,7 @@ bool WalletModel::blacklistAddressFromColdStaking(const QString &addressStr)

bool WalletModel::updateAddressBookPurpose(const QString &addressStr, const std::string& purpose)
{
bool isStaking, isExchange = false;
bool isStaking = false, isExchange = false;
CTxDestination address = DecodeDestination(addressStr.toStdString(), isStaking, isExchange);
if (isStaking)
return error("Invalid PIVX address, cold staking address");
Expand Down

0 comments on commit 1021b81

Please sign in to comment.