bool CWalletDB::WriteWatchOnly(const CScript &dest, const CKeyMetadata& keyMeta) { if (!WriteIC(std::make_pair(std::string("watchmeta"), dest), keyMeta)) { return false; } return WriteIC(std::make_pair(std::string("watchs"), dest), '1'); }
bool CWalletDB::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta) { if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta, false)) { return false; } // hash pubkey/privkey to accelerate wallet load std::vector<unsigned char> vchKey; vchKey.reserve(vchPubKey.size() + vchPrivKey.size()); vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end()); return WriteIC(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); }
bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, const CKeyMetadata &keyMeta) { if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) { return false; } if (!WriteIC(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) { return false; } EraseIC(std::make_pair(std::string("key"), vchPubKey)); EraseIC(std::make_pair(std::string("wkey"), vchPubKey)); return true; }
bool WalletBatch::WriteOfflineXPubKey(const CExtPubKey& offline_xpub) { std::vector<unsigned char> vxpub; vxpub.resize(BIP32_EXTKEY_SIZE); offline_xpub.Encode(&vxpub[0]); return WriteIC(std::string("offlinexpub"), vxpub); }
bool CWalletDB::WriteOrderPosNext(int64_t nOrderPosNext) { return WriteIC(std::string("orderposnext"), nOrderPosNext); }
bool CWalletDB::WriteTx(const CWalletTx& wtx) { return WriteIC(std::make_pair(std::string("tx"), wtx.GetHash()), wtx); }
bool CWalletDB::WritePurpose(const std::string& strAddress, const std::string& strPurpose) { return WriteIC(std::make_pair(std::string("purpose"), strAddress), strPurpose); }
bool CWalletDB::WriteName(const std::string& strAddress, const std::string& strName) { return WriteIC(std::make_pair(std::string("name"), strAddress), strName); }
bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry) { return WriteIC(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry); }
bool CWalletDB::WriteAccount(const std::string& strAccount, const CAccount& account) { return WriteIC(std::make_pair(std::string("acc"), strAccount), account); }
bool CWalletDB::WriteCScript(const uint160& hash, const CScript& redeemScript) { return WriteIC(std::make_pair(std::string("cscript"), hash), redeemScript, false); }
bool CWalletDB::WriteBestBlock(const CBlockLocator& locator) { WriteIC(std::string("bestblock"), CBlockLocator()); // Write empty block locator so versions that require a merkle branch automatically rescan return WriteIC(std::string("bestblock_nomerkle"), locator); }
bool CWalletDB::WriteDefaultKey(const CPubKey& vchPubKey) { return WriteIC(std::string("defaultkey"), vchPubKey); }
bool WalletBatch::WriteSpecificBlindingKey(const uint160& scriptid, const uint256& key) { return WriteIC(std::make_pair(std::string("specificblindingkey"), scriptid), key); }
bool WalletBatch::WriteBlindingDerivationKey(const uint256& key) { return WriteIC(std::string("blindingderivationkey"), key); }
bool WalletBatch::WriteOfflineCounter(int counter) { return WriteIC(std::string("offlinecounter"), counter); }
bool WalletBatch::WriteOfflineDescriptor(const std::string& offline_desc) { return WriteIC(std::string("offlinedesc"), offline_desc); }
bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey) { return WriteIC(std::make_pair(std::string("mkey"), nID), kMasterKey, true); }
bool CWalletDB::WritePool(int64_t nPool, const CKeyPool& keypool) { return WriteIC(std::make_pair(std::string("pool"), nPool), keypool); }
bool CWalletDB::WriteMinVersion(int nVersion) { return WriteIC(std::string("minversion"), nVersion); }
bool WalletBatch::WriteOnlineKey(const CPubKey& online_key) { return WriteIC(std::string("onlinekey"), online_key); }