1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2012 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_WALLET_H
6 #define BITCOIN_WALLET_H
17 #include "ui_interface.h"
21 extern bool fWalletUnlockMintOnly;
22 extern bool fConfChange;
23 class CAccountingEntry;
29 /** (client) version numbers for particular wallet features */
32 FEATURE_BASE = 10500, // the earliest version new wallets supports (only useful for getinfo's clientversion output)
34 FEATURE_WALLETCRYPT = 40000, // wallet encryption
35 FEATURE_COMPRPUBKEY = 60000, // compressed public keys
37 FEATURE_LATEST = 60000
40 /** A key pool entry */
52 CKeyPool(const CPubKey& vchPubKeyIn)
55 vchPubKey = vchPubKeyIn;
60 if (!(nType & SER_GETHASH))
67 /** A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
68 * and provides the ability to create new transactions.
70 class CWallet : public CCryptoKeyStore
73 bool SelectCoinsSimple(int64 nTargetValue, unsigned int nSpendTime, int nMinConf, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const;
74 bool SelectCoins(int64 nTargetValue, unsigned int nSpendTime, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet, const CCoinControl *coinControl=NULL) const;
76 CWalletDB *pwalletdbEncryption;
78 // the current wallet version: clients below this version are not able to load the wallet
81 // the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded
82 int nWalletMaxVersion;
85 mutable CCriticalSection cs_wallet;
88 std::string strWalletFile;
90 std::set<int64> setKeyPool;
91 std::map<CKeyID, CKeyMetadata> mapKeyMetadata;
94 typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
95 MasterKeyMap mapMasterKeys;
96 unsigned int nMasterKeyMaxID;
100 nWalletVersion = FEATURE_BASE;
101 nWalletMaxVersion = FEATURE_BASE;
104 pwalletdbEncryption = NULL;
107 CWallet(std::string strWalletFileIn)
109 nWalletVersion = FEATURE_BASE;
110 nWalletMaxVersion = FEATURE_BASE;
111 strWalletFile = strWalletFileIn;
114 pwalletdbEncryption = NULL;
118 std::map<uint256, CWalletTx> mapWallet;
120 std::map<uint256, int> mapRequestCount;
122 std::map<CTxDestination, std::string> mapAddressBook;
124 CPubKey vchDefaultKey;
127 // check whether we are allowed to upgrade (or already support) to the named feature
128 bool CanSupportFeature(enum WalletFeature wf) { return nWalletMaxVersion >= wf; }
130 void AvailableCoinsMinConf(std::vector<COutput>& vCoins, int nConf) const;
131 void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl=NULL) const;
132 bool SelectCoinsMinConf(int64 nTargetValue, unsigned int nSpendTime, int nConfMine, int nConfTheirs, std::vector<COutput> vCoins, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const;
133 // keystore implementation
134 // Generate a new key
135 CPubKey GenerateNewKey();
136 // Adds a key to the store, and saves it to disk.
137 bool AddKey(const CKey& key);
138 // Adds a key to the store, without saving it to disk (used by LoadWallet)
139 bool LoadKey(const CKey& key) { return CCryptoKeyStore::AddKey(key); }
140 // Load metadata (used by LoadWallet)
141 bool LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &metadata);
143 bool LoadMinVersion(int nVersion) { nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; }
145 // Adds an encrypted key to the store, and saves it to disk.
146 bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
147 // Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
148 bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { SetMinVersion(FEATURE_WALLETCRYPT); return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); }
149 bool AddCScript(const CScript& redeemScript);
150 bool LoadCScript(const CScript& redeemScript) { return CCryptoKeyStore::AddCScript(redeemScript); }
152 // Adds a watch-only address to the store, and saves it to disk.
153 bool AddWatchOnly(const CTxDestination &dest);
154 // Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
155 bool LoadWatchOnly(const CTxDestination &dest);
157 bool Unlock(const SecureString& strWalletPassphrase);
158 bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
159 bool EncryptWallet(const SecureString& strWalletPassphrase);
161 void GetKeyBirthTimes(std::map<CKeyID, int64> &mapKeyBirth) const;
164 /** Increment the next transaction order id
165 @return next transaction order id
167 int64 IncOrderPosNext(CWalletDB *pwalletdb = NULL);
169 typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair;
170 typedef std::multimap<int64, TxPair > TxItems;
172 /** Get the wallet's activity log
173 @return multimap of ordered transactions and accounting entries
174 @warning Returned pointers are *only* valid within the scope of passed acentries
176 TxItems OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount = "");
179 bool AddToWallet(const CWalletTx& wtxIn);
180 bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate = false, bool fFindBlock = false);
181 bool EraseFromWallet(uint256 hash);
182 void WalletUpdateSpent(const CTransaction& prevout, bool fBlock = false);
183 int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
184 int ScanForWalletTransaction(const uint256& hashTx);
185 void ReacceptWalletTransactions();
186 void ResendWalletTransactions();
187 int64 GetBalance() const;
188 void GetBalance(int64 &nTotal, int64 &nWatchOnly) const;
189 int64 GetUnconfirmedBalance() const;
190 int64 GetImmatureBalance() const;
191 int64 GetStake() const;
192 int64 GetNewMint() const;
193 bool CreateTransaction(const std::vector<std::pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet, const CCoinControl *coinControl=NULL);
194 bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet, const CCoinControl *coinControl=NULL);
195 bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
197 bool GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint64& nMaxWeight, uint64& nWeight);
198 void GetStakeWeightFromValue(const int64& nTime, const int64& nValue, uint64& nWeight);
199 bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64 nSearchInterval, CTransaction& txNew, CKey& key);
201 std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
202 std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
205 bool TopUpKeyPool(unsigned int nSize = 0);
206 int64 AddReserveKey(const CKeyPool& keypool);
207 void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
208 void KeepKey(int64 nIndex);
209 void ReturnKey(int64 nIndex);
210 bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true);
211 int64 GetOldestKeyPoolTime();
212 void GetAllReserveKeys(std::set<CKeyID>& setAddress) const;
214 std::set< std::set<CTxDestination> > GetAddressGroupings();
215 std::map<CTxDestination, int64> GetAddressBalances();
217 isminetype IsMine(const CTxIn& txin) const;
218 int64 GetDebit(const CTxIn& txin) const;
219 isminetype IsMine(const CTxOut& txout) const
221 return ::IsMine(*this, txout.scriptPubKey);
223 int64 GetCredit(const CTxOut& txout, bool fWatchOnly=false) const
225 if (!MoneyRange(txout.nValue))
226 throw std::runtime_error("CWallet::GetCredit() : value out of range");
227 isminetype ismine = IsMine(txout);
228 if (fWatchOnly && ismine != MINE_WATCH_ONLY)
230 return (ismine != MINE_NO ? txout.nValue : 0);
232 bool IsChange(const CTxOut& txout) const;
233 int64 GetChange(const CTxOut& txout) const
235 if (!MoneyRange(txout.nValue))
236 throw std::runtime_error("CWallet::GetChange() : value out of range");
237 return (IsChange(txout) ? txout.nValue : 0);
239 bool IsMine(const CTransaction& tx) const
241 BOOST_FOREACH(const CTxOut& txout, tx.vout)
242 if (IsMine(txout) && txout.nValue >= nMinimumInputValue)
246 bool IsFromMe(const CTransaction& tx) const
248 return (GetDebit(tx) > 0);
250 int64 GetDebit(const CTransaction& tx) const
253 BOOST_FOREACH(const CTxIn& txin, tx.vin)
255 nDebit += GetDebit(txin);
256 if (!MoneyRange(nDebit))
257 throw std::runtime_error("CWallet::GetDebit() : value out of range");
261 int64 GetCredit(const CTransaction& tx, bool fWatchOnly=true) const
264 BOOST_FOREACH(const CTxOut& txout, tx.vout)
266 if (!fWatchOnly || (fWatchOnly && IsMine(txout) == MINE_WATCH_ONLY))
267 nCredit += GetCredit(txout);
269 if (!MoneyRange(nCredit))
270 throw std::runtime_error("CWallet::GetCredit() : value out of range");
274 int64 GetChange(const CTransaction& tx) const
277 BOOST_FOREACH(const CTxOut& txout, tx.vout)
279 nChange += GetChange(txout);
280 if (!MoneyRange(nChange))
281 throw std::runtime_error("CWallet::GetChange() : value out of range");
285 void SetBestChain(const CBlockLocator& loc);
287 DBErrors LoadWallet(bool& fFirstRunRet);
289 bool SetAddressBookName(const CTxDestination& address, const std::string& strName);
291 bool DelAddressBookName(const CTxDestination& address);
293 void UpdatedTransaction(const uint256 &hashTx);
295 void PrintWallet(const CBlock& block);
297 void Inventory(const uint256 &hash)
301 std::map<uint256, int>::iterator mi = mapRequestCount.find(hash);
302 if (mi != mapRequestCount.end())
307 unsigned int GetKeyPoolSize()
309 return setKeyPool.size();
312 bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx);
314 bool SetDefaultKey(const CPubKey &vchPubKey);
316 // signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower
317 bool SetMinVersion(enum WalletFeature, CWalletDB* pwalletdbIn = NULL, bool fExplicit = false);
319 // change which version we're allowed to upgrade to (note that this does not immediately imply upgrading to that format)
320 bool SetMaxVersion(int nVersion);
322 // get the current wallet format (the oldest client version guaranteed to understand this wallet)
323 int GetVersion() { return nWalletVersion; }
325 void FixSpentCoins(int& nMismatchSpent, int64& nBalanceInQuestion, bool fCheckOnly = false);
326 void DisableTransaction(const CTransaction &tx);
328 /** Address book entry changed.
329 * @note called with lock cs_wallet held.
331 boost::signals2::signal<void (CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, ChangeType status)> NotifyAddressBookChanged;
333 /** Wallet transaction added, removed or updated.
334 * @note called with lock cs_wallet held.
336 boost::signals2::signal<void (CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged;
339 /** A key allocated from the key pool. */
347 CReserveKey(CWallet* pwalletIn)
360 CPubKey GetReservedKey();
365 typedef std::map<std::string, std::string> mapValue_t;
368 static void ReadOrderPos(int64& nOrderPos, mapValue_t& mapValue)
370 if (!mapValue.count("n"))
372 nOrderPos = -1; // TODO: calculate elsewhere
375 nOrderPos = atoi64(mapValue["n"].c_str());
379 static void WriteOrderPos(const int64& nOrderPos, mapValue_t& mapValue)
383 mapValue["n"] = i64tostr(nOrderPos);
387 /** A transaction with a bunch of additional info that only the owner cares about.
388 * It includes any unrecorded transactions needed to link it back to the block chain.
390 class CWalletTx : public CMerkleTx
393 const CWallet* pwallet;
396 std::vector<CMerkleTx> vtxPrev;
398 std::vector<std::pair<std::string, std::string> > vOrderForm;
399 unsigned int fTimeReceivedIsTxTime;
400 unsigned int nTimeReceived; // time received by this node
401 unsigned int nTimeSmart;
403 std::string strFromAccount;
404 std::vector<char> vfSpent; // which outputs are already spent
405 int64 nOrderPos; // position in ordered transaction list
408 mutable bool fDebitCached;
409 mutable bool fCreditCached;
410 mutable bool fWatchOnlyCreditCached;
411 mutable bool fAvailableCreditCached;
412 mutable bool fAvailableWatchOnlyCreditCached;
413 mutable bool fChangeCached;
414 mutable int64 nDebitCached;
415 mutable int64 nCreditCached;
416 mutable int64 nWatchOnlyCreditCached;
417 mutable int64 nAvailableCreditCached;
418 mutable int64 nAvailableWatchOnlyCreditCached;
419 mutable int64 nChangeCached;
426 CWalletTx(const CWallet* pwalletIn)
431 CWalletTx(const CWallet* pwalletIn, const CMerkleTx& txIn) : CMerkleTx(txIn)
436 CWalletTx(const CWallet* pwalletIn, const CTransaction& txIn) : CMerkleTx(txIn)
441 void Init(const CWallet* pwalletIn)
447 fTimeReceivedIsTxTime = false;
451 strFromAccount.clear();
453 fDebitCached = false;
454 fCreditCached = false;
455 fWatchOnlyCreditCached = false;
456 fAvailableCreditCached = false;
457 fAvailableWatchOnlyCreditCached = false;
458 fChangeCached = false;
461 nWatchOnlyCreditCached = 0;
462 nAvailableCreditCached = 0;
463 nAvailableWatchOnlyCreditCached = 0;
470 CWalletTx* pthis = const_cast<CWalletTx*>(this);
477 pthis->mapValue["fromaccount"] = pthis->strFromAccount;
480 BOOST_FOREACH(char f, vfSpent)
482 str += (f ? '1' : '0');
486 pthis->mapValue["spent"] = str;
488 WriteOrderPos(pthis->nOrderPos, pthis->mapValue);
491 pthis->mapValue["timesmart"] = strprintf("%u", nTimeSmart);
494 nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion,ser_action);
497 READWRITE(vOrderForm);
498 READWRITE(fTimeReceivedIsTxTime);
499 READWRITE(nTimeReceived);
505 pthis->strFromAccount = pthis->mapValue["fromaccount"];
507 if (mapValue.count("spent"))
508 BOOST_FOREACH(char c, pthis->mapValue["spent"])
509 pthis->vfSpent.push_back(c != '0');
511 pthis->vfSpent.assign(vout.size(), fSpent);
513 ReadOrderPos(pthis->nOrderPos, pthis->mapValue);
515 pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
518 pthis->mapValue.erase("fromaccount");
519 pthis->mapValue.erase("version");
520 pthis->mapValue.erase("spent");
521 pthis->mapValue.erase("n");
522 pthis->mapValue.erase("timesmart");
525 // marks certain txout's as spent
526 // returns true if any update took place
527 bool UpdateSpent(const std::vector<char>& vfNewSpent)
529 bool fReturn = false;
530 for (unsigned int i = 0; i < vfNewSpent.size(); i++)
532 if (i == vfSpent.size())
535 if (vfNewSpent[i] && !vfSpent[i])
539 fAvailableCreditCached = fAvailableWatchOnlyCreditCached = false;
545 // make sure balances are recalculated
548 fCreditCached = false;
549 fAvailableCreditCached = fAvailableWatchOnlyCreditCached = false;
550 fDebitCached = false;
551 fChangeCached = false;
554 void BindWallet(CWallet *pwalletIn)
560 void MarkSpent(unsigned int nOut)
562 if (nOut >= vout.size())
563 throw std::runtime_error("CWalletTx::MarkSpent() : nOut out of range");
564 vfSpent.resize(vout.size());
567 vfSpent[nOut] = true;
568 fAvailableCreditCached = fAvailableWatchOnlyCreditCached = false;
572 void MarkUnspent(unsigned int nOut)
574 if (nOut >= vout.size())
575 throw std::runtime_error("CWalletTx::MarkUnspent() : nOut out of range");
576 vfSpent.resize(vout.size());
579 vfSpent[nOut] = false;
580 fAvailableCreditCached = fAvailableWatchOnlyCreditCached = false;
584 bool IsSpent(unsigned int nOut) const
586 if (nOut >= vout.size())
587 throw std::runtime_error("CWalletTx::IsSpent() : nOut out of range");
588 if (nOut >= vfSpent.size())
590 return (!!vfSpent[nOut]);
593 int64 GetDebit() const
599 nDebitCached = pwallet->GetDebit(*this);
604 int64 GetCredit(bool fWatchOnly, bool fUseCache=true) const
606 // Must wait until coinbase is safely deep enough in the chain before valuing it
607 if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0)
610 // GetBalance can assume transactions in mapWallet won't change
612 if (fWatchOnly && fCreditCached)
613 return nWatchOnlyCreditCached;
615 return nCreditCached;
619 nWatchOnlyCreditCached = pwallet->GetCredit(*this, true);
620 fWatchOnlyCreditCached = true;
622 return nWatchOnlyCreditCached;
625 nCreditCached = pwallet->GetCredit(*this);
626 fCreditCached = true;
628 return nCreditCached;
631 int64 GetAvailableCredit(bool fWatchOnly, bool fUseCache=true) const
633 // Must wait until coinbase is safely deep enough in the chain before valuing it
634 if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0)
638 if (fWatchOnly && fAvailableWatchOnlyCreditCached)
639 return nAvailableWatchOnlyCreditCached;
641 if (fAvailableCreditCached)
642 return nAvailableCreditCached;
646 for (unsigned int i = 0; i < vout.size(); i++)
650 const CTxOut &txout = vout[i];
651 nCredit += pwallet->GetCredit(txout, fWatchOnly);
652 if (!MoneyRange(nCredit))
653 throw std::runtime_error("CWalletTx::GetAvailableCredit() : value out of range");
658 nAvailableWatchOnlyCreditCached = nCredit;
659 fAvailableWatchOnlyCreditCached = true;
661 nAvailableCreditCached = nCredit;
662 fAvailableCreditCached = true;
668 int64 GetChange() const
671 return nChangeCached;
672 nChangeCached = pwallet->GetChange(*this);
673 fChangeCached = true;
674 return nChangeCached;
677 void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CTxDestination, int64> >& listReceived,
678 std::list<std::pair<CTxDestination, int64> >& listSent, int64& nFee, std::string& strSentAccount) const;
680 void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived,
681 int64& nSent, int64& nFee) const;
683 bool IsFromMe() const
685 return (GetDebit() > 0);
688 bool IsTrusted() const
690 // Quick answer in most cases
693 if (GetDepthInMainChain() >= 1)
695 if (fConfChange || !IsFromMe()) // using wtx's cached debit
698 // If no confirmations but it's from us, we can still
699 // consider it confirmed if all dependencies are confirmed
700 std::map<uint256, const CMerkleTx*> mapPrev;
701 std::vector<const CMerkleTx*> vWorkQueue;
702 vWorkQueue.reserve(vtxPrev.size()+1);
703 vWorkQueue.push_back(this);
704 for (unsigned int i = 0; i < vWorkQueue.size(); i++)
706 const CMerkleTx* ptx = vWorkQueue[i];
710 if (ptx->GetDepthInMainChain() >= 1)
712 if (!pwallet->IsFromMe(*ptx))
717 BOOST_FOREACH(const CMerkleTx& tx, vtxPrev)
718 mapPrev[tx.GetHash()] = &tx;
721 BOOST_FOREACH(const CTxIn& txin, ptx->vin)
723 if (!mapPrev.count(txin.prevout.hash))
725 vWorkQueue.push_back(mapPrev[txin.prevout.hash]);
734 int64 GetTxTime() const;
735 int GetRequestCount() const;
737 void AddSupportingTransactions(CTxDB& txdb);
739 bool AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs=true);
740 bool AcceptWalletTransaction();
742 void RelayWalletTransaction(CTxDB& txdb);
743 void RelayWalletTransaction();
757 COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn)
759 tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn;
762 std::string ToString() const
764 return strprintf("COutput(%s, %d, %d, %d) [%s]", tx->GetHash().ToString().substr(0,10).c_str(), i, fSpendable, nDepth, FormatMoney(tx->vout[i].nValue).c_str());
769 printf("%s\n", ToString().c_str());
776 /** Private key that includes an expiration date in case it never gets used. */
783 std::string strComment;
784 //// todo: add something to note what created it (user, getnewaddress, change)
785 //// maybe should have a map<string, string> property map
787 CWalletKey(int64 nExpires=0)
789 nTimeCreated = (nExpires ? GetTime() : 0);
790 nTimeExpires = nExpires;
795 if (!(nType & SER_GETHASH))
797 READWRITE(vchPrivKey);
798 READWRITE(nTimeCreated);
799 READWRITE(nTimeExpires);
800 READWRITE(strComment);
809 /** Account information.
810 * Stored in wallet with key "acc"+string account name.
824 vchPubKey = CPubKey();
829 if (!(nType & SER_GETHASH))
831 READWRITE(vchPubKey);
837 /** Internal transfers.
838 * Database key is acentry<account><counter>.
840 class CAccountingEntry
843 std::string strAccount;
846 std::string strOtherAccount;
847 std::string strComment;
849 int64 nOrderPos; // position in ordered transaction list
862 strOtherAccount.clear();
869 CAccountingEntry& me = *const_cast<CAccountingEntry*>(this);
870 if (!(nType & SER_GETHASH))
872 // Note: strAccount is serialized as part of the key, not here.
873 READWRITE(nCreditDebit);
875 READWRITE(strOtherAccount);
879 WriteOrderPos(nOrderPos, me.mapValue);
881 if (!(mapValue.empty() && _ssExtra.empty()))
883 CDataStream ss(nType, nVersion);
884 ss.insert(ss.begin(), '\0');
886 ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end());
887 me.strComment.append(ss.str());
891 READWRITE(strComment);
893 size_t nSepPos = strComment.find("\0", 0, 1);
897 if (std::string::npos != nSepPos)
899 CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), nType, nVersion);
901 me._ssExtra = std::vector<char>(ss.begin(), ss.end());
903 ReadOrderPos(me.nOrderPos, me.mapValue);
905 if (std::string::npos != nSepPos)
906 me.strComment.erase(nSepPos);
908 me.mapValue.erase("n");
912 std::vector<char> _ssExtra;
915 bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);