// mapWallet
//
+CWallet::CWallet()
+{
+ SetNull();
+}
+
+CWallet::CWallet(std::string strWalletFileIn)
+{
+ SetNull();
+
+ strWalletFile = strWalletFileIn;
+ fFileBacked = true;
+}
+
+void CWallet::SetNull()
+{
+ nWalletVersion = FEATURE_BASE;
+ nWalletMaxVersion = FEATURE_BASE;
+ fFileBacked = false;
+ nMasterKeyMaxID = 0;
+ pwalletdbEncryption = NULL;
+ pwalletdbDecryption = NULL;
+ nNextResend = 0;
+ nLastResend = 0;
+ nOrderPosNext = 0;
+ nKernelsTried = 0;
+ nCoinDaysTried = 0;
+ nTimeFirstKey = 0;
+}
+
struct CompareValueOnly
{
bool operator()(const pair<int64_t, pair<const CWalletTx*, unsigned int> >& t1,
return MINE_NO;
}
+CWalletTx::CWalletTx()
+{
+ Init(NULL);
+}
+
+CWalletTx::CWalletTx(const CWallet* pwalletIn)
+{
+ Init(pwalletIn);
+}
+
+CWalletTx::CWalletTx(const CWallet* pwalletIn, const CMerkleTx& txIn) : CMerkleTx(txIn)
+{
+ Init(pwalletIn);
+}
+
+CWalletTx::CWalletTx(const CWallet* pwalletIn, const CTransaction& txIn) : CMerkleTx(txIn)
+{
+ Init(pwalletIn);
+}
+
+void CWalletTx::Init(const CWallet* pwalletIn)
+{
+ pwallet = pwalletIn;
+ vtxPrev.clear();
+ mapValue.clear();
+ vOrderForm.clear();
+ fTimeReceivedIsTxTime = false;
+ nTimeReceived = 0;
+ nTimeSmart = 0;
+ fFromMe = false;
+ strFromAccount.clear();
+ vfSpent.clear();
+ fDebitCached = false;
+ fWatchDebitCached = false;
+ fCreditCached = false;
+ fWatchCreditCached = false;
+ fAvailableCreditCached = false;
+ fAvailableWatchCreditCached = false;
+ fImmatureCreditCached = false;
+ fImmatureWatchCreditCached = false;
+ fChangeCached = false;
+ nDebitCached = 0;
+ nWatchDebitCached = 0;
+ nCreditCached = 0;
+ nWatchCreditCached = 0;
+ nAvailableCreditCached = 0;
+ nAvailableWatchCreditCached = 0;
+ nImmatureCreditCached = 0;
+ nImmatureWatchCreditCached = 0;
+ nChangeCached = 0;
+ nOrderPos = -1;
+}
+
// marks certain txout's as spent
// returns true if any update took place
bool CWalletTx::UpdateSpent(const vector<char>& vfNewSpent)
if (wtxNew.vout[0].nValue <= 0)
return false;
- for (unsigned int i = 0; i < wtxNew.vin.size(); i++) {
+ for (uint32_t i = 0; i < wtxNew.vin.size(); i++) {
const CWalletTx *txin = vwtxPrev[i];
// Sign all scripts again
}
// Limit size
- unsigned int nBytes = ::GetSerializeSize(txNew, SER_NETWORK, PROTOCOL_VERSION);
+ auto nBytes = ::GetSerializeSize(txNew, SER_NETWORK, PROTOCOL_VERSION);
if (nBytes >= MAX_BLOCK_SIZE_GEN/5)
return error("CreateCoinStake : exceeded coinstake size limit\n");