mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-17 18:40:09 +00:00
Make CWalletTx::pwallet private
This commit is contained in:
parent
8214620178
commit
4c6e22953e
@ -810,7 +810,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
|
|||||||
ssKey >> hash;
|
ssKey >> hash;
|
||||||
CWalletTx& wtx = pwallet->mapWallet[hash];
|
CWalletTx& wtx = pwallet->mapWallet[hash];
|
||||||
ssValue >> wtx;
|
ssValue >> wtx;
|
||||||
wtx.pwallet = pwallet;
|
wtx.BindWallet(pwallet);
|
||||||
|
|
||||||
if (wtx.GetHash() != hash)
|
if (wtx.GetHash() != hash)
|
||||||
printf("Error in wallet.dat, hash mismatch\n");
|
printf("Error in wallet.dat, hash mismatch\n");
|
||||||
|
@ -232,7 +232,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
|
|||||||
// Inserts only if not already there, returns tx inserted or tx found
|
// Inserts only if not already there, returns tx inserted or tx found
|
||||||
pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn));
|
pair<map<uint256, CWalletTx>::iterator, bool> ret = mapWallet.insert(make_pair(hash, wtxIn));
|
||||||
CWalletTx& wtx = (*ret.first).second;
|
CWalletTx& wtx = (*ret.first).second;
|
||||||
wtx.pwallet = this;
|
wtx.BindWallet(this);
|
||||||
bool fInsertedNew = ret.second;
|
bool fInsertedNew = ret.second;
|
||||||
if (fInsertedNew)
|
if (fInsertedNew)
|
||||||
wtx.nTimeReceived = GetAdjustedTime();
|
wtx.nTimeReceived = GetAdjustedTime();
|
||||||
@ -924,7 +924,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CW
|
|||||||
if (vecSend.empty() || nValue < 0)
|
if (vecSend.empty() || nValue < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wtxNew.pwallet = this;
|
wtxNew.BindWallet(this);
|
||||||
|
|
||||||
CRITICAL_BLOCK(cs_main)
|
CRITICAL_BLOCK(cs_main)
|
||||||
CRITICAL_BLOCK(cs_wallet)
|
CRITICAL_BLOCK(cs_wallet)
|
||||||
@ -1062,7 +1062,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
|
|||||||
BOOST_FOREACH(const CTxIn& txin, wtxNew.vin)
|
BOOST_FOREACH(const CTxIn& txin, wtxNew.vin)
|
||||||
{
|
{
|
||||||
CWalletTx &coin = mapWallet[txin.prevout.hash];
|
CWalletTx &coin = mapWallet[txin.prevout.hash];
|
||||||
coin.pwallet = this;
|
coin.BindWallet(this);
|
||||||
coin.MarkSpent(txin.prevout.n);
|
coin.MarkSpent(txin.prevout.n);
|
||||||
coin.WriteToDisk();
|
coin.WriteToDisk();
|
||||||
vWalletUpdated.push_back(coin.GetHash());
|
vWalletUpdated.push_back(coin.GetHash());
|
||||||
|
@ -243,9 +243,10 @@ public:
|
|||||||
//
|
//
|
||||||
class CWalletTx : public CMerkleTx
|
class CWalletTx : public CMerkleTx
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
const CWallet* pwallet;
|
const CWallet* pwallet;
|
||||||
|
|
||||||
|
public:
|
||||||
std::vector<CMerkleTx> vtxPrev;
|
std::vector<CMerkleTx> vtxPrev;
|
||||||
std::map<std::string, std::string> mapValue;
|
std::map<std::string, std::string> mapValue;
|
||||||
std::vector<std::pair<std::string, std::string> > vOrderForm;
|
std::vector<std::pair<std::string, std::string> > vOrderForm;
|
||||||
@ -389,6 +390,12 @@ public:
|
|||||||
fChangeCached = false;
|
fChangeCached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BindWallet(CWallet *pwalletIn)
|
||||||
|
{
|
||||||
|
pwallet = pwalletIn;
|
||||||
|
MarkDirty();
|
||||||
|
}
|
||||||
|
|
||||||
void MarkSpent(unsigned int nOut)
|
void MarkSpent(unsigned int nOut)
|
||||||
{
|
{
|
||||||
if (nOut >= vout.size())
|
if (nOut >= vout.size())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user