genesis 1
genesis 2
genesis 3
genesis 4
genesis 5 #ifndef BITCOIN_WALLET_H
genesis 6 #define BITCOIN_WALLET_H
genesis 7
genesis 8 #include "bignum.h"
genesis 9 #include "key.h"
genesis 10 #include "script.h"
genesis 11
genesis 12 class CWalletTx;
genesis 13 class CReserveKey;
genesis 14 class CWalletDB;
genesis 15
genesis 16
genesis 17
genesis 18
genesis 19 class CWallet : public CCryptoKeyStore
genesis 20 {
genesis 21 private:
genesis 22 bool SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfTheirs, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const;
genesis 23 bool SelectCoins(int64 nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const;
genesis 24
genesis 25 CWalletDB *pwalletdbEncryption;
genesis 26
genesis 27 public:
genesis 28 mutable CCriticalSection cs_wallet;
genesis 29
genesis 30 bool fFileBacked;
genesis 31 std::string strWalletFile;
genesis 32
genesis 33 std::set<int64> setKeyPool;
genesis 34
genesis 35 typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
genesis 36 MasterKeyMap mapMasterKeys;
genesis 37 unsigned int nMasterKeyMaxID;
genesis 38
genesis 39 CWallet()
genesis 40 {
genesis 41 fFileBacked = false;
genesis 42 nMasterKeyMaxID = 0;
genesis 43 pwalletdbEncryption = NULL;
genesis 44 }
genesis 45 CWallet(std::string strWalletFileIn)
genesis 46 {
genesis 47 strWalletFile = strWalletFileIn;
genesis 48 fFileBacked = true;
genesis 49 nMasterKeyMaxID = 0;
genesis 50 pwalletdbEncryption = NULL;
genesis 51 }
genesis 52
genesis 53 std::map<uint256, CWalletTx> mapWallet;
genesis 54 std::vector<uint256> vWalletUpdated;
genesis 55
genesis 56 std::map<uint256, int> mapRequestCount;
genesis 57
genesis 58 std::map<CBitcoinAddress, std::string> mapAddressBook;
genesis 59
genesis 60 std::vector<unsigned char> vchDefaultKey;
genesis 61
genesis 62
genesis 63
genesis 64 bool AddKey(const CKey& key);
genesis 65
genesis 66 bool LoadKey(const CKey& key) { return CCryptoKeyStore::AddKey(key); }
genesis 67
genesis 68
genesis 69 bool AddCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
genesis 70
genesis 71 bool LoadCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); }
genesis 72
genesis 73 bool Unlock(const SecureString& strWalletPassphrase);
genesis 74 bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
genesis 75 bool EncryptWallet(const SecureString& strWalletPassphrase);
funken_prikey_tools 76 void MarkDirty();
genesis 77
genesis 78 bool AddToWallet(const CWalletTx& wtxIn);
genesis 79 bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate = false);
genesis 80 bool EraseFromWallet(uint256 hash);
genesis 81 void WalletUpdateSpent(const CTransaction& prevout);
genesis 82 int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
genesis 83 void ReacceptWalletTransactions();
genesis 84 void ResendWalletTransactions();
genesis 85 int64 GetBalance() const;
genesis 86 int64 GetUnconfirmedBalance() const;
genesis 87 bool CreateTransaction(const std::vector<std::pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
genesis 88 bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
genesis 89 bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
genesis 90 std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
genesis 91 std::string SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
genesis 92
genesis 93 bool NewKeyPool();
genesis 94 bool TopUpKeyPool();
genesis 95 void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
genesis 96 void KeepKey(int64 nIndex);
genesis 97 void ReturnKey(int64 nIndex);
genesis 98 bool GetKeyFromPool(std::vector<unsigned char> &key, bool fAllowReuse=true);
genesis 99 int64 GetOldestKeyPoolTime();
genesis 100
genesis 101 bool IsMine(const CTxIn& txin) const;
genesis 102 int64 GetDebit(const CTxIn& txin) const;
genesis 103 bool IsMine(const CTxOut& txout) const
genesis 104 {
genesis 105 return ::IsMine(*this, txout.scriptPubKey);
genesis 106 }
genesis 107 int64 GetCredit(const CTxOut& txout) const
genesis 108 {
genesis 109 if (!MoneyRange(txout.nValue))
genesis 110 throw std::runtime_error("CWallet::GetCredit() : value out of range");
genesis 111 return (IsMine(txout) ? txout.nValue : 0);
genesis 112 }
genesis 113 bool IsChange(const CTxOut& txout) const
genesis 114 {
genesis 115 CBitcoinAddress address;
genesis 116 if (ExtractAddress(txout.scriptPubKey, this, address))
genesis 117 CRITICAL_BLOCK(cs_wallet)
genesis 118 if (!mapAddressBook.count(address))
genesis 119 return true;
genesis 120 return false;
genesis 121 }
genesis 122 int64 GetChange(const CTxOut& txout) const
genesis 123 {
genesis 124 if (!MoneyRange(txout.nValue))
genesis 125 throw std::runtime_error("CWallet::GetChange() : value out of range");
genesis 126 return (IsChange(txout) ? txout.nValue : 0);
genesis 127 }
genesis 128 bool IsMine(const CTransaction& tx) const
genesis 129 {
genesis 130 BOOST_FOREACH(const CTxOut& txout, tx.vout)
genesis 131 if (IsMine(txout))
genesis 132 return true;
genesis 133 return false;
genesis 134 }
genesis 135 bool IsFromMe(const CTransaction& tx) const
genesis 136 {
genesis 137 return (GetDebit(tx) > 0);
genesis 138 }
genesis 139 int64 GetDebit(const CTransaction& tx) const
genesis 140 {
genesis 141 int64 nDebit = 0;
genesis 142 BOOST_FOREACH(const CTxIn& txin, tx.vin)
genesis 143 {
genesis 144 nDebit += GetDebit(txin);
genesis 145 if (!MoneyRange(nDebit))
genesis 146 throw std::runtime_error("CWallet::GetDebit() : value out of range");
genesis 147 }
genesis 148 return nDebit;
genesis 149 }
genesis 150 int64 GetCredit(const CTransaction& tx) const
genesis 151 {
genesis 152 int64 nCredit = 0;
genesis 153 BOOST_FOREACH(const CTxOut& txout, tx.vout)
genesis 154 {
genesis 155 nCredit += GetCredit(txout);
genesis 156 if (!MoneyRange(nCredit))
genesis 157 throw std::runtime_error("CWallet::GetCredit() : value out of range");
genesis 158 }
genesis 159 return nCredit;
genesis 160 }
genesis 161 int64 GetChange(const CTransaction& tx) const
genesis 162 {
genesis 163 int64 nChange = 0;
genesis 164 BOOST_FOREACH(const CTxOut& txout, tx.vout)
genesis 165 {
genesis 166 nChange += GetChange(txout);
genesis 167 if (!MoneyRange(nChange))
genesis 168 throw std::runtime_error("CWallet::GetChange() : value out of range");
genesis 169 }
genesis 170 return nChange;
genesis 171 }
genesis 172 void SetBestChain(const CBlockLocator& loc)
genesis 173 {
genesis 174 CWalletDB walletdb(strWalletFile);
genesis 175 walletdb.WriteBestBlock(loc);
genesis 176 }
genesis 177
genesis 178 int LoadWallet(bool& fFirstRunRet);
genesis 179
genesis 180
genesis 181 bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName);
genesis 182
genesis 183 bool DelAddressBookName(const CBitcoinAddress& address);
genesis 184
genesis 185 void UpdatedTransaction(const uint256 &hashTx)
genesis 186 {
genesis 187 CRITICAL_BLOCK(cs_wallet)
genesis 188 vWalletUpdated.push_back(hashTx);
genesis 189 }
genesis 190
genesis 191 void PrintWallet(const CBlock& block);
genesis 192
genesis 193 void Inventory(const uint256 &hash)
genesis 194 {
genesis 195 CRITICAL_BLOCK(cs_wallet)
genesis 196 {
genesis 197 std::map<uint256, int>::iterator mi = mapRequestCount.find(hash);
genesis 198 if (mi != mapRequestCount.end())
genesis 199 (*mi).second++;
genesis 200 }
genesis 201 }
genesis 202
genesis 203 int GetKeyPoolSize()
genesis 204 {
genesis 205 return setKeyPool.size();
genesis 206 }
genesis 207
genesis 208 bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx);
genesis 209
genesis 210 bool SetDefaultKey(const std::vector<unsigned char> &vchPubKey);
genesis 211 };
genesis 212
genesis 213
genesis 214 class CReserveKey
genesis 215 {
genesis 216 protected:
genesis 217 CWallet* pwallet;
genesis 218 int64 nIndex;
genesis 219 std::vector<unsigned char> vchPubKey;
genesis 220 public:
genesis 221 CReserveKey(CWallet* pwalletIn)
genesis 222 {
genesis 223 nIndex = -1;
genesis 224 pwallet = pwalletIn;
genesis 225 }
genesis 226
genesis 227 ~CReserveKey()
genesis 228 {
genesis 229 if (!fShutdown)
genesis 230 ReturnKey();
genesis 231 }
genesis 232
genesis 233 void ReturnKey();
genesis 234 std::vector<unsigned char> GetReservedKey();
genesis 235 void KeepKey();
genesis 236 };
genesis 237
genesis 238
genesis 239
genesis 240
genesis 241
genesis 242
genesis 243
genesis 244 class CWalletTx : public CMerkleTx
genesis 245 {
genesis 246 public:
genesis 247 const CWallet* pwallet;
genesis 248
genesis 249 std::vector<CMerkleTx> vtxPrev;
genesis 250 std::map<std::string, std::string> mapValue;
genesis 251 std::vector<std::pair<std::string, std::string> > vOrderForm;
genesis 252 unsigned int fTimeReceivedIsTxTime;
genesis 253 unsigned int nTimeReceived;
genesis 254 char fFromMe;
genesis 255 std::string strFromAccount;
genesis 256 std::vector<char> vfSpent;
genesis 257
genesis 258
genesis 259 mutable char fDebitCached;
genesis 260 mutable char fCreditCached;
genesis 261 mutable char fAvailableCreditCached;
genesis 262 mutable char fChangeCached;
genesis 263 mutable int64 nDebitCached;
genesis 264 mutable int64 nCreditCached;
genesis 265 mutable int64 nAvailableCreditCached;
genesis 266 mutable int64 nChangeCached;
genesis 267
genesis 268
genesis 269 mutable unsigned int nTimeDisplayed;
genesis 270 mutable int nLinesDisplayed;
genesis 271 mutable char fConfirmedDisplayed;
genesis 272
genesis 273 CWalletTx()
genesis 274 {
genesis 275 Init(NULL);
genesis 276 }
genesis 277
genesis 278 CWalletTx(const CWallet* pwalletIn)
genesis 279 {
genesis 280 Init(pwalletIn);
genesis 281 }
genesis 282
genesis 283 CWalletTx(const CWallet* pwalletIn, const CMerkleTx& txIn) : CMerkleTx(txIn)
genesis 284 {
genesis 285 Init(pwalletIn);
genesis 286 }
genesis 287
genesis 288 CWalletTx(const CWallet* pwalletIn, const CTransaction& txIn) : CMerkleTx(txIn)
genesis 289 {
genesis 290 Init(pwalletIn);
genesis 291 }
genesis 292
genesis 293 void Init(const CWallet* pwalletIn)
genesis 294 {
genesis 295 pwallet = pwalletIn;
genesis 296 vtxPrev.clear();
genesis 297 mapValue.clear();
genesis 298 vOrderForm.clear();
genesis 299 fTimeReceivedIsTxTime = false;
genesis 300 nTimeReceived = 0;
genesis 301 fFromMe = false;
genesis 302 strFromAccount.clear();
genesis 303 vfSpent.clear();
genesis 304 fDebitCached = false;
genesis 305 fCreditCached = false;
genesis 306 fAvailableCreditCached = false;
genesis 307 fChangeCached = false;
genesis 308 nDebitCached = 0;
genesis 309 nCreditCached = 0;
genesis 310 nAvailableCreditCached = 0;
genesis 311 nChangeCached = 0;
genesis 312 nTimeDisplayed = 0;
genesis 313 nLinesDisplayed = 0;
genesis 314 fConfirmedDisplayed = false;
genesis 315 }
genesis 316
genesis 317 IMPLEMENT_SERIALIZE
genesis 318 (
genesis 319 CWalletTx* pthis = const_cast<CWalletTx*>(this);
genesis 320 if (fRead)
genesis 321 pthis->Init(NULL);
genesis 322 char fSpent = false;
genesis 323
genesis 324 if (!fRead)
genesis 325 {
genesis 326 pthis->mapValue["fromaccount"] = pthis->strFromAccount;
genesis 327
genesis 328 std::string str;
genesis 329 BOOST_FOREACH(char f, vfSpent)
genesis 330 {
genesis 331 str += (f ? '1' : '0');
genesis 332 if (f)
genesis 333 fSpent = true;
genesis 334 }
genesis 335 pthis->mapValue["spent"] = str;
genesis 336 }
genesis 337
genesis 338 nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion,ser_action);
genesis 339 READWRITE(vtxPrev);
genesis 340 READWRITE(mapValue);
genesis 341 READWRITE(vOrderForm);
genesis 342 READWRITE(fTimeReceivedIsTxTime);
genesis 343 READWRITE(nTimeReceived);
genesis 344 READWRITE(fFromMe);
genesis 345 READWRITE(fSpent);
genesis 346
genesis 347 if (fRead)
genesis 348 {
genesis 349 pthis->strFromAccount = pthis->mapValue["fromaccount"];
genesis 350
genesis 351 if (mapValue.count("spent"))
genesis 352 BOOST_FOREACH(char c, pthis->mapValue["spent"])
genesis 353 pthis->vfSpent.push_back(c != '0');
genesis 354 else
genesis 355 pthis->vfSpent.assign(vout.size(), fSpent);
genesis 356 }
genesis 357
genesis 358 pthis->mapValue.erase("fromaccount");
genesis 359 pthis->mapValue.erase("version");
genesis 360 pthis->mapValue.erase("spent");
genesis 361 )
genesis 362
genesis 363
genesis 364
genesis 365 bool UpdateSpent(const std::vector<char>& vfNewSpent)
genesis 366 {
genesis 367 bool fReturn = false;
genesis 368 for (int i=0; i < vfNewSpent.size(); i++)
genesis 369 {
genesis 370 if (i == vfSpent.size())
genesis 371 break;
genesis 372
genesis 373 if (vfNewSpent[i] && !vfSpent[i])
genesis 374 {
genesis 375 vfSpent[i] = true;
genesis 376 fReturn = true;
genesis 377 fAvailableCreditCached = false;
genesis 378 }
genesis 379 }
genesis 380 return fReturn;
genesis 381 }
genesis 382
genesis 383
genesis 384 void MarkDirty()
genesis 385 {
genesis 386 fCreditCached = false;
genesis 387 fAvailableCreditCached = false;
genesis 388 fDebitCached = false;
genesis 389 fChangeCached = false;
genesis 390 }
genesis 391
genesis 392 void MarkSpent(unsigned int nOut)
genesis 393 {
genesis 394 if (nOut >= vout.size())
genesis 395 throw std::runtime_error("CWalletTx::MarkSpent() : nOut out of range");
genesis 396 vfSpent.resize(vout.size());
genesis 397 if (!vfSpent[nOut])
genesis 398 {
genesis 399 vfSpent[nOut] = true;
genesis 400 fAvailableCreditCached = false;
genesis 401 }
genesis 402 }
genesis 403
genesis 404 bool IsSpent(unsigned int nOut) const
genesis 405 {
genesis 406 if (nOut >= vout.size())
genesis 407 throw std::runtime_error("CWalletTx::IsSpent() : nOut out of range");
genesis 408 if (nOut >= vfSpent.size())
genesis 409 return false;
genesis 410 return (!!vfSpent[nOut]);
genesis 411 }
genesis 412
genesis 413 int64 GetDebit() const
genesis 414 {
genesis 415 if (vin.empty())
genesis 416 return 0;
genesis 417 if (fDebitCached)
genesis 418 return nDebitCached;
genesis 419 nDebitCached = pwallet->GetDebit(*this);
genesis 420 fDebitCached = true;
genesis 421 return nDebitCached;
genesis 422 }
genesis 423
genesis 424 int64 GetCredit(bool fUseCache=true) const
genesis 425 {
genesis 426
genesis 427 if (IsCoinBase() && GetBlocksToMaturity() > 0)
genesis 428 return 0;
genesis 429
genesis 430
genesis 431 if (fUseCache && fCreditCached)
genesis 432 return nCreditCached;
genesis 433 nCreditCached = pwallet->GetCredit(*this);
genesis 434 fCreditCached = true;
genesis 435 return nCreditCached;
genesis 436 }
genesis 437
genesis 438 int64 GetAvailableCredit(bool fUseCache=true) const
genesis 439 {
genesis 440
genesis 441 if (IsCoinBase() && GetBlocksToMaturity() > 0)
genesis 442 return 0;
genesis 443
genesis 444 if (fUseCache && fAvailableCreditCached)
genesis 445 return nAvailableCreditCached;
genesis 446
genesis 447 int64 nCredit = 0;
genesis 448 for (int i = 0; i < vout.size(); i++)
genesis 449 {
genesis 450 if (!IsSpent(i))
genesis 451 {
genesis 452 const CTxOut &txout = vout[i];
genesis 453 nCredit += pwallet->GetCredit(txout);
genesis 454 if (!MoneyRange(nCredit))
genesis 455 throw std::runtime_error("CWalletTx::GetAvailableCredit() : value out of range");
genesis 456 }
genesis 457 }
genesis 458
genesis 459 nAvailableCreditCached = nCredit;
genesis 460 fAvailableCreditCached = true;
genesis 461 return nCredit;
genesis 462 }
genesis 463
genesis 464
genesis 465 int64 GetChange() const
genesis 466 {
genesis 467 if (fChangeCached)
genesis 468 return nChangeCached;
genesis 469 nChangeCached = pwallet->GetChange(*this);
genesis 470 fChangeCached = true;
genesis 471 return nChangeCached;
genesis 472 }
genesis 473
genesis 474 void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CBitcoinAddress, int64> >& listReceived,
genesis 475 std::list<std::pair<CBitcoinAddress, int64> >& listSent, int64& nFee, std::string& strSentAccount) const;
genesis 476
genesis 477 void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived,
genesis 478 int64& nSent, int64& nFee) const;
genesis 479
genesis 480 bool IsFromMe() const
genesis 481 {
genesis 482 return (GetDebit() > 0);
genesis 483 }
genesis 484
genesis 485 bool IsConfirmed() const
genesis 486 {
genesis 487
genesis 488 if (!IsFinal())
genesis 489 return false;
genesis 490 if (GetDepthInMainChain() >= 1)
genesis 491 return true;
genesis 492 if (!IsFromMe())
genesis 493 return false;
genesis 494
genesis 495
genesis 496
genesis 497 std::map<uint256, const CMerkleTx*> mapPrev;
genesis 498 std::vector<const CMerkleTx*> vWorkQueue;
genesis 499 vWorkQueue.reserve(vtxPrev.size()+1);
genesis 500 vWorkQueue.push_back(this);
genesis 501 for (int i = 0; i < vWorkQueue.size(); i++)
genesis 502 {
genesis 503 const CMerkleTx* ptx = vWorkQueue[i];
genesis 504
genesis 505 if (!ptx->IsFinal())
genesis 506 return false;
genesis 507 if (ptx->GetDepthInMainChain() >= 1)
genesis 508 continue;
genesis 509 if (!pwallet->IsFromMe(*ptx))
genesis 510 return false;
genesis 511
genesis 512 if (mapPrev.empty())
genesis 513 BOOST_FOREACH(const CMerkleTx& tx, vtxPrev)
genesis 514 mapPrev[tx.GetHash()] = &tx;
genesis 515
genesis 516 BOOST_FOREACH(const CTxIn& txin, ptx->vin)
genesis 517 {
genesis 518 if (!mapPrev.count(txin.prevout.hash))
genesis 519 return false;
genesis 520 vWorkQueue.push_back(mapPrev[txin.prevout.hash]);
genesis 521 }
genesis 522 }
genesis 523 return true;
genesis 524 }
genesis 525
genesis 526 bool WriteToDisk();
genesis 527
genesis 528 int64 GetTxTime() const;
genesis 529 int GetRequestCount() const;
genesis 530
genesis 531 void AddSupportingTransactions(CTxDB& txdb);
genesis 532
genesis 533 bool AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs=true);
genesis 534 bool AcceptWalletTransaction();
genesis 535
genesis 536 void RelayWalletTransaction(CTxDB& txdb);
genesis 537 void RelayWalletTransaction();
genesis 538 };
genesis 539
genesis 540
genesis 541
genesis 542
genesis 543
genesis 544 class CWalletKey
genesis 545 {
genesis 546 public:
genesis 547 CPrivKey vchPrivKey;
genesis 548 int64 nTimeCreated;
genesis 549 int64 nTimeExpires;
genesis 550 std::string strComment;
genesis 551
genesis 552
genesis 553
genesis 554 CWalletKey(int64 nExpires=0)
genesis 555 {
genesis 556 nTimeCreated = (nExpires ? GetTime() : 0);
genesis 557 nTimeExpires = nExpires;
genesis 558 }
genesis 559
genesis 560 IMPLEMENT_SERIALIZE
genesis 561 (
genesis 562 if (!(nType & SER_GETHASH))
genesis 563 READWRITE(nVersion);
genesis 564 READWRITE(vchPrivKey);
genesis 565 READWRITE(nTimeCreated);
genesis 566 READWRITE(nTimeExpires);
genesis 567 READWRITE(strComment);
genesis 568 )
genesis 569 };
genesis 570
genesis 571
genesis 572
genesis 573
genesis 574
genesis 575
genesis 576
genesis 577
genesis 578
genesis 579
genesis 580 class CAccount
genesis 581 {
genesis 582 public:
genesis 583 std::vector<unsigned char> vchPubKey;
genesis 584
genesis 585 CAccount()
genesis 586 {
genesis 587 SetNull();
genesis 588 }
genesis 589
genesis 590 void SetNull()
genesis 591 {
genesis 592 vchPubKey.clear();
genesis 593 }
genesis 594
genesis 595 IMPLEMENT_SERIALIZE
genesis 596 (
genesis 597 if (!(nType & SER_GETHASH))
genesis 598 READWRITE(nVersion);
genesis 599 READWRITE(vchPubKey);
genesis 600 )
genesis 601 };
genesis 602
genesis 603
genesis 604
genesis 605
genesis 606
genesis 607
genesis 608
genesis 609 class CAccountingEntry
genesis 610 {
genesis 611 public:
genesis 612 std::string strAccount;
genesis 613 int64 nCreditDebit;
genesis 614 int64 nTime;
genesis 615 std::string strOtherAccount;
genesis 616 std::string strComment;
genesis 617
genesis 618 CAccountingEntry()
genesis 619 {
genesis 620 SetNull();
genesis 621 }
genesis 622
genesis 623 void SetNull()
genesis 624 {
genesis 625 nCreditDebit = 0;
genesis 626 nTime = 0;
genesis 627 strAccount.clear();
genesis 628 strOtherAccount.clear();
genesis 629 strComment.clear();
genesis 630 }
genesis 631
genesis 632 IMPLEMENT_SERIALIZE
genesis 633 (
genesis 634 if (!(nType & SER_GETHASH))
genesis 635 READWRITE(nVersion);
genesis 636
genesis 637 READWRITE(nCreditDebit);
genesis 638 READWRITE(nTime);
genesis 639 READWRITE(strOtherAccount);
genesis 640 READWRITE(strComment);
genesis 641 )
genesis 642 };
genesis 643
genesis 644 bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);
genesis 645
genesis 646 #endif