diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-11-18 16:55:54 +0100 |
---|---|---|
committer | Cozz Lovan <cozzlovan@yahoo.com> | 2014-01-19 18:21:54 +0100 |
commit | b10e147096b0e27fdff8c22029bc8b7a1a14f042 (patch) | |
tree | deb52bf797444b448e79df495d4a98906407af44 /src/walletdb.cpp | |
parent | dd7c1cf534b760e9da55c225d6bb05f2bdb8e2e7 (diff) |
wallet: add interface for storing generic data on destinations
Diffstat (limited to 'src/walletdb.cpp')
-rw-r--r-- | src/walletdb.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 9c5bddba60..2e61c6cd58 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -564,6 +564,18 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, { ssValue >> pwallet->nOrderPosNext; } + else if (strType == "destdata") + { + std::string strAddress, strKey, strValue; + ssKey >> strAddress; + ssKey >> strKey; + ssValue >> strValue; + if (!pwallet->LoadDestData(CBitcoinAddress(strAddress).Get(), strKey, strValue)) + { + strErr = "Error reading wallet database: LoadDestData failed"; + return false; + } + } } catch (...) { return false; @@ -865,3 +877,15 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename) { return CWalletDB::Recover(dbenv, filename, false); } + +bool CWalletDB::WriteDestData(const std::string &address, const std::string &key, const std::string &value) +{ + nWalletDBUpdated++; + return Write(boost::make_tuple(std::string("destdata"), address, key), value); +} + +bool CWalletDB::EraseDestData(const std::string &address, const std::string &key) +{ + nWalletDBUpdated++; + return Erase(boost::make_tuple(string("destdata"), address, key)); +} |