Skip to content

Commit

Permalink
Merge PIVX-Project#572: [Qt] Refresh zPIV balance after resetting min…
Browse files Browse the repository at this point in the history
…ts or spends

992763b [Qt] Refresh zPIV balance after resetting mints or spends (warrows)

Tree-SHA512: bea53d1632e6410144613f4a83de3ed232dc21c05b5eb091b5f6dcde55f67057190708d3493b54a7b243a60c6701054bdc85239625c41d3d5a32c630192b4b54
  • Loading branch information
Mrs-X committed Mar 16, 2018
2 parents 8c8350b + 992763b commit d9b23fe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ static void NotifyZerocoinChanged(WalletModel* walletmodel, CWallet* wallet, con
Q_ARG(int, status));
}

static void NotifyzPIVReset(WalletModel* walletmodel)
{
qDebug() << "NotifyzPIVReset";
QMetaObject::invokeMethod(walletmodel, "checkBalanceChanged", Qt::QueuedConnection);
}

void WalletModel::subscribeToCoreSignals()
{
// Connect signals to wallet
Expand All @@ -577,6 +583,7 @@ void WalletModel::subscribeToCoreSignals()
wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1));
wallet->NotifyMultiSigChanged.connect(boost::bind(NotifyMultiSigChanged, this, _1));
wallet->NotifyZerocoinChanged.connect(boost::bind(NotifyZerocoinChanged, this, _1, _2, _3, _4));
wallet->NotifyzPIVReset.connect(boost::bind(NotifyzPIVReset, this));
}

void WalletModel::unsubscribeFromCoreSignals()
Expand All @@ -589,6 +596,7 @@ void WalletModel::unsubscribeFromCoreSignals()
wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1));
wallet->NotifyMultiSigChanged.disconnect(boost::bind(NotifyMultiSigChanged, this, _1));
wallet->NotifyZerocoinChanged.disconnect(boost::bind(NotifyZerocoinChanged, this, _1, _2, _3, _4));
wallet->NotifyzPIVReset.disconnect(boost::bind(NotifyzPIVReset, this));
}

// WalletModel::UnlockContext implementation
Expand Down
2 changes: 1 addition & 1 deletion src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class WalletModel : public QObject

void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();
void checkBalanceChanged();
Q_INVOKABLE void checkBalanceChanged();

signals:
// Signal that balance in wallet changed
Expand Down
4 changes: 4 additions & 0 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4791,6 +4791,8 @@ string CWallet::ResetMintZerocoin(bool fExtendedSearch)
walletdb.ArchiveMintOrphan(mint);
}

NotifyzPIVReset();

string strResult = _("ResetMintZerocoin finished: ") + to_string(updates) + _(" mints updated, ") + to_string(deletions) + _(" mints deleted\n");
return strResult;
}
Expand Down Expand Up @@ -4830,6 +4832,8 @@ string CWallet::ResetSpentZerocoin()
}
}

NotifyzPIVReset();

string strResult = _("ResetSpentZerocoin finished: ") + to_string(removed) + _(" unconfirmed transactions removed\n");
return strResult;
}
Expand Down
3 changes: 3 additions & 0 deletions src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface

/** MultiSig address added */
boost::signals2::signal<void(bool fHaveMultiSig)> NotifyMultiSigChanged;

/** zPIV reset */
boost::signals2::signal<void()> NotifyzPIVReset;
};


Expand Down

0 comments on commit d9b23fe

Please sign in to comment.