aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-07-22 16:50:39 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-08-22 16:18:25 +1000
commita41d5fe01947f2f878c055670986a165af800f9a (patch)
tree40eeada1ebc180f8e3669a7d164104686dc0c618 /src/wallet.cpp
parent47d0534368fbf0e3fb2cad7d05d60501d29f62aa (diff)
Payment Protocol: X509-validated payment requests
Add support for a Payment Protocol to Bitcoin-Qt. Payment messages are protocol-buffer encoded and communicated over http(s), so this adds a dependency on the Google protocol buffer library, and requires Qt with OpenSSL support.
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index c0f2d74ca7..ddfd71efda 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -496,7 +496,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
if (GetKeyFromPool(newDefaultKey, false))
{
SetDefaultKey(newDefaultKey);
- SetAddressBookName(vchDefaultKey.GetID(), "");
+ SetAddressBook(vchDefaultKey.GetID(), "", "receive");
}
}
}
@@ -1457,26 +1457,28 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
}
-bool CWallet::SetAddressBookName(const CTxDestination& address, const string& strName)
+bool CWallet::SetAddressBook(const CTxDestination& address, const string& strName, const string& strPurpose)
{
std::map<CTxDestination, CAddressBookData>::iterator mi = mapAddressBook.find(address);
mapAddressBook[address].name = strName;
NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED);
if (!fFileBacked)
return false;
+ if (!strPurpose.empty() && !CWalletDB(strWalletFile).WritePurpose(CBitcoinAddress(address).ToString(), strPurpose))
+ return false;
return CWalletDB(strWalletFile).WriteName(CBitcoinAddress(address).ToString(), strName);
}
-bool CWallet::DelAddressBookName(const CTxDestination& address)
+bool CWallet::DelAddressBook(const CTxDestination& address)
{
mapAddressBook.erase(address);
NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED);
if (!fFileBacked)
return false;
+ CWalletDB(strWalletFile).ErasePurpose(CBitcoinAddress(address).ToString());
return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString());
}
-
void CWallet::PrintWallet(const CBlock& block)
{
{