mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
interfaces: Stop exposing wallet destdata to gui
Stop giving GUI access to destdata rows in database. Replace with narrow API just for saving and reading receive request information. This simplifies code and should prevent the GUI from interfering with other destdata like address-used status. Note: No user-visible behavior is changing in this commit. New CWallet::SetAddressReceiveRequest() implementation avoids a bug in CWallet::AddDestData() where a modification would leave the previous value in memory while writing the new value to disk. But it doesn't matter because the GUI doesn't currently expose the ability to modify receive requests, only to add and erase them.
This commit is contained in:
@@ -463,25 +463,6 @@ void WalletModel::UnlockContext::CopyFrom(UnlockContext&& rhs)
|
||||
rhs.relock = false;
|
||||
}
|
||||
|
||||
void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests)
|
||||
{
|
||||
vReceiveRequests = m_wallet->getDestValues("rr"); // receive request
|
||||
}
|
||||
|
||||
bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
|
||||
{
|
||||
CTxDestination dest = DecodeDestination(sAddress);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << nId;
|
||||
std::string key = "rr" + ss.str(); // "rr" prefix = "receive request" in destdata
|
||||
|
||||
if (sRequest.empty())
|
||||
return m_wallet->eraseDestData(dest, key);
|
||||
else
|
||||
return m_wallet->addDestData(dest, key, sRequest);
|
||||
}
|
||||
|
||||
bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
||||
{
|
||||
CCoinControl coin_control;
|
||||
|
||||
Reference in New Issue
Block a user