Skip to content

Commit 603759b

Browse files
committed
fixup! Rename account to label where appropriate
Revert CAccount rename as suggested #11536 (comment)
1 parent 5cf5e03 commit 603759b

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

src/wallet/wallet.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -811,21 +811,21 @@ bool CWallet::AccountMove(std::string strFrom, std::string strTo, CAmount nAmoun
811811
return true;
812812
}
813813

814-
bool CWallet::GetLabelPubkey(CPubKey &pubKey, std::string label_name, bool bForceNew)
814+
bool CWallet::GetLabelPubkey(CPubKey &pubKey, std::string label, bool bForceNew)
815815
{
816816
CWalletDB walletdb(*dbw);
817817

818-
CLabel label;
819-
walletdb.ReadLabel(label_name, label);
818+
CAccount account;
819+
walletdb.ReadAccount(label, account);
820820

821821
if (!bForceNew) {
822-
if (!label.vchPubKey.IsValid())
822+
if (!account.vchPubKey.IsValid())
823823
bForceNew = true;
824824
else {
825825
// Check if the current key has been used
826-
CScript scriptPubKey = GetScriptForDestination(label.vchPubKey.GetID());
826+
CScript scriptPubKey = GetScriptForDestination(account.vchPubKey.GetID());
827827
for (std::map<uint256, CWalletTx>::iterator it = mapWallet.begin();
828-
it != mapWallet.end() && label.vchPubKey.IsValid();
828+
it != mapWallet.end() && account.vchPubKey.IsValid();
829829
++it)
830830
for (const CTxOut& txout : (*it).second.tx->vout)
831831
if (txout.scriptPubKey == scriptPubKey) {
@@ -837,14 +837,14 @@ bool CWallet::GetLabelPubkey(CPubKey &pubKey, std::string label_name, bool bForc
837837

838838
// Generate a new key
839839
if (bForceNew) {
840-
if (!GetKeyFromPool(label.vchPubKey, false))
840+
if (!GetKeyFromPool(account.vchPubKey, false))
841841
return false;
842842

843-
SetAddressBook(label.vchPubKey.GetID(), label_name, "receive");
844-
walletdb.WriteLabel(label_name, label);
843+
SetAddressBook(account.vchPubKey.GetID(), label, "receive");
844+
walletdb.WriteAccount(label, account);
845845
}
846846

847-
pubKey = label.vchPubKey;
847+
pubKey = account.vchPubKey;
848848

849849
return true;
850850
}

src/wallet/wallet.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,15 +1141,15 @@ class CReserveKey final : public CReserveScript
11411141

11421142

11431143
/**
1144-
* Label information.
1145-
* Stored in wallet with key "acc"+string label name.
1144+
* Account information.
1145+
* Stored in wallet with key "acc"+string account name.
11461146
*/
1147-
class CLabel
1147+
class CAccount
11481148
{
11491149
public:
11501150
CPubKey vchPubKey;
11511151

1152-
CLabel()
1152+
CAccount()
11531153
{
11541154
SetNull();
11551155
}

src/wallet/walletdb.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ bool CWalletDB::WriteMinVersion(int nVersion)
150150
return WriteIC(std::string("minversion"), nVersion);
151151
}
152152

153-
bool CWalletDB::ReadLabel(const std::string& label_name, CLabel& label)
153+
bool CWalletDB::ReadAccount(const std::string& strAccount, CAccount& account)
154154
{
155-
label.SetNull();
156-
return batch.Read(std::make_pair(std::string("acc"), label_name), label);
155+
account.SetNull();
156+
return batch.Read(std::make_pair(std::string("acc"), strAccount), account);
157157
}
158158

159-
bool CWalletDB::WriteLabel(const std::string& label_name, const CLabel& label)
159+
bool CWalletDB::WriteAccount(const std::string& strAccount, const CAccount& account)
160160
{
161-
return WriteIC(std::make_pair(std::string("acc"), label_name), label);
161+
return WriteIC(std::make_pair(std::string("acc"), strAccount), account);
162162
}
163163

164164
bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry)

src/wallet/walletdb.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
static const bool DEFAULT_FLUSHWALLET = true;
3636

37-
class CLabel;
37+
class CAccount;
3838
class CAccountingEntry;
3939
struct CBlockLocator;
4040
class CKeyPool;
@@ -202,8 +202,8 @@ class CWalletDB
202202
/// This writes directly to the database, and will not update the CWallet's cached accounting entries!
203203
/// Use wallet.AddAccountingEntry instead, to write *and* update its caches.
204204
bool WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry);
205-
bool ReadLabel(const std::string& label_name, CLabel& label);
206-
bool WriteLabel(const std::string& label_name, const CLabel& label);
205+
bool ReadAccount(const std::string& strAccount, CAccount& account);
206+
bool WriteAccount(const std::string& strAccount, const CAccount& account);
207207

208208
/// Write destination data key,value tuple to database
209209
bool WriteDestData(const std::string &address, const std::string &key, const std::string &value);

0 commit comments

Comments
 (0)