Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 883 Lines • ▼ Show 20 Lines | bool CWallet::AccountMove(std::string strFrom, std::string strTo, | ||||
credit.nTime = nNow; | credit.nTime = nNow; | ||||
credit.strOtherAccount = strFrom; | credit.strOtherAccount = strFrom; | ||||
credit.strComment = strComment; | credit.strComment = strComment; | ||||
AddAccountingEntry(credit, &walletdb); | AddAccountingEntry(credit, &walletdb); | ||||
return walletdb.TxnCommit(); | return walletdb.TxnCommit(); | ||||
} | } | ||||
bool CWallet::GetLabelAddress(CPubKey &pubKey, const std::string &label, | bool CWallet::GetLabelDestination(CTxDestination &dest, | ||||
bool bForceNew) { | const std::string &label, bool bForceNew) { | ||||
CWalletDB walletdb(*dbw); | CWalletDB walletdb(*dbw); | ||||
CAccount account; | CAccount account; | ||||
walletdb.ReadAccount(label, account); | walletdb.ReadAccount(label, account); | ||||
if (!bForceNew) { | if (!bForceNew) { | ||||
if (!account.vchPubKey.IsValid()) { | if (!account.vchPubKey.IsValid()) { | ||||
bForceNew = true; | bForceNew = true; | ||||
Show All 14 Lines | bool CWallet::GetLabelDestination(CTxDestination &dest, | ||||
} | } | ||||
// Generate a new key | // Generate a new key | ||||
if (bForceNew) { | if (bForceNew) { | ||||
if (!GetKeyFromPool(account.vchPubKey, false)) { | if (!GetKeyFromPool(account.vchPubKey, false)) { | ||||
return false; | return false; | ||||
} | } | ||||
SetAddressBook(account.vchPubKey.GetID(), label, "receive"); | dest = account.vchPubKey.GetID(); | ||||
SetAddressBook(dest, label, "receive"); | |||||
walletdb.WriteAccount(label, account); | walletdb.WriteAccount(label, account); | ||||
} else { | |||||
dest = account.vchPubKey.GetID(); | |||||
} | } | ||||
pubKey = account.vchPubKey; | |||||
return true; | return true; | ||||
} | } | ||||
void CWallet::MarkDirty() { | void CWallet::MarkDirty() { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
for (std::pair<const TxId, CWalletTx> &item : mapWallet) { | for (std::pair<const TxId, CWalletTx> &item : mapWallet) { | ||||
item.second.MarkDirty(); | item.second.MarkDirty(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,574 Lines • Show Last 20 Lines |