|
1 | 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto
|
2 | 2 | // Copyright (c) 2009-2014 The Bitcoin developers
|
3 |
| -// Distributed under the MIT/X11 software license, see the accompanying |
| 3 | +// Distributed under the MIT software license, see the accompanying |
4 | 4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 |
|
6 | 6 | #include "wallet.h"
|
|
22 | 22 |
|
23 | 23 | using namespace std;
|
24 | 24 |
|
25 |
| -// Settings |
| 25 | +/** |
| 26 | + * Settings |
| 27 | + */ |
26 | 28 | CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
|
27 | 29 | unsigned int nTxConfirmTarget = 1;
|
28 | 30 | bool bSpendZeroConfChange = true;
|
29 | 31 |
|
30 |
| -/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */ |
31 |
| -CFeeRate CWallet::minTxFee = CFeeRate(10000); // Override with -mintxfee |
| 32 | +/** |
| 33 | + * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) |
| 34 | + * Override with -mintxfee |
| 35 | + */ |
| 36 | +CFeeRate CWallet::minTxFee = CFeeRate(10000); |
32 | 37 |
|
33 |
| -////////////////////////////////////////////////////////////////////////////// |
34 |
| -// |
35 |
| -// mapWallet |
36 |
| -// |
| 38 | +/** @defgroup mapWallet |
| 39 | + * |
| 40 | + * @{ |
| 41 | + */ |
37 | 42 |
|
38 | 43 | struct CompareValueOnly
|
39 | 44 | {
|
@@ -367,8 +372,10 @@ void CWallet::SyncMetaData(pair<TxSpends::iterator, TxSpends::iterator> range)
|
367 | 372 | }
|
368 | 373 | }
|
369 | 374 |
|
370 |
| -// Outpoint is spent if any non-conflicted transaction |
371 |
| -// spends it: |
| 375 | +/** |
| 376 | + * Outpoint is spent if any non-conflicted transaction |
| 377 | + * spends it: |
| 378 | + */ |
372 | 379 | bool CWallet::IsSpent(const uint256& hash, unsigned int n) const
|
373 | 380 | {
|
374 | 381 | const COutPoint outpoint(hash, n);
|
@@ -477,7 +484,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
|
477 | 484 | {
|
478 | 485 | if (!pwalletdbEncryption->TxnCommit()) {
|
479 | 486 | delete pwalletdbEncryption;
|
480 |
| - // We now have keys encrypted in memory, but no on disk... |
| 487 | + // We now have keys encrypted in memory, but not on disk... |
481 | 488 | // die to avoid confusion and let the user reload their unencrypted wallet.
|
482 | 489 | assert(false);
|
483 | 490 | }
|
@@ -667,9 +674,11 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
|
667 | 674 | return true;
|
668 | 675 | }
|
669 | 676 |
|
670 |
| -// Add a transaction to the wallet, or update it. |
671 |
| -// pblock is optional, but should be provided if the transaction is known to be in a block. |
672 |
| -// If fUpdate is true, existing transactions will be updated. |
| 677 | +/** |
| 678 | + * Add a transaction to the wallet, or update it. |
| 679 | + * pblock is optional, but should be provided if the transaction is known to be in a block. |
| 680 | + * If fUpdate is true, existing transactions will be updated. |
| 681 | + */ |
673 | 682 | bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate)
|
674 | 683 | {
|
675 | 684 | {
|
@@ -911,9 +920,11 @@ bool CWalletTx::WriteToDisk()
|
911 | 920 | return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this);
|
912 | 921 | }
|
913 | 922 |
|
914 |
| -// Scan the block chain (starting in pindexStart) for transactions |
915 |
| -// from or to us. If fUpdate is true, found transactions that already |
916 |
| -// exist in the wallet will be updated. |
| 923 | +/** |
| 924 | + * Scan the block chain (starting in pindexStart) for transactions |
| 925 | + * from or to us. If fUpdate is true, found transactions that already |
| 926 | + * exist in the wallet will be updated. |
| 927 | + */ |
917 | 928 | int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
918 | 929 | {
|
919 | 930 | int ret = 0;
|
@@ -1035,15 +1046,15 @@ void CWallet::ResendWalletTransactions()
|
1035 | 1046 | }
|
1036 | 1047 | }
|
1037 | 1048 |
|
| 1049 | +/** @} */ // end of mapWallet |
1038 | 1050 |
|
1039 | 1051 |
|
1040 | 1052 |
|
1041 | 1053 |
|
1042 |
| - |
1043 |
| -////////////////////////////////////////////////////////////////////////////// |
1044 |
| -// |
1045 |
| -// Actions |
1046 |
| -// |
| 1054 | +/** @defgroup Actions |
| 1055 | + * |
| 1056 | + * @{ |
| 1057 | + */ |
1047 | 1058 |
|
1048 | 1059 |
|
1049 | 1060 | CAmount CWallet::GetBalance() const
|
@@ -1136,7 +1147,9 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
|
1136 | 1147 | return nTotal;
|
1137 | 1148 | }
|
1138 | 1149 |
|
1139 |
| -// populate vCoins with vector of available COutputs. |
| 1150 | +/** |
| 1151 | + * populate vCoins with vector of available COutputs. |
| 1152 | + */ |
1140 | 1153 | void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl) const
|
1141 | 1154 | {
|
1142 | 1155 | vCoins.clear();
|
@@ -1194,7 +1207,7 @@ static void ApproximateBestSubset(vector<pair<CAmount, pair<const CWalletTx*,uns
|
1194 | 1207 | //The solver here uses a randomized algorithm,
|
1195 | 1208 | //the randomness serves no real security purpose but is just
|
1196 | 1209 | //needed to prevent degenerate behavior and it is important
|
1197 |
| - //that the rng fast. We do not use a constant random sequence, |
| 1210 | + //that the rng is fast. We do not use a constant random sequence, |
1198 | 1211 | //because there may be some privacy improvement by making
|
1199 | 1212 | //the selection random.
|
1200 | 1213 | if (nPass == 0 ? insecure_rand()&1 : !vfIncluded[i])
|
@@ -1524,7 +1537,9 @@ bool CWallet::CreateTransaction(CScript scriptPubKey, const CAmount& nValue,
|
1524 | 1537 | return CreateTransaction(vecSend, wtxNew, reservekey, nFeeRet, strFailReason, coinControl);
|
1525 | 1538 | }
|
1526 | 1539 |
|
1527 |
| -// Call after CreateTransaction unless you want to abort |
| 1540 | +/** |
| 1541 | + * Call after CreateTransaction unless you want to abort |
| 1542 | + */ |
1528 | 1543 | bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
|
1529 | 1544 | {
|
1530 | 1545 | {
|
@@ -1669,7 +1684,7 @@ DBErrors CWallet::ZapWalletTx(std::vector<CWalletTx>& vWtx)
|
1669 | 1684 | setKeyPool.clear();
|
1670 | 1685 | // Note: can't top-up keypool here, because wallet is locked.
|
1671 | 1686 | // User will be prompted to unlock wallet the next operation
|
1672 |
| - // the requires a new key. |
| 1687 | + // that requires a new key. |
1673 | 1688 | }
|
1674 | 1689 | }
|
1675 | 1690 |
|
@@ -1736,10 +1751,10 @@ bool CWallet::SetDefaultKey(const CPubKey &vchPubKey)
|
1736 | 1751 | return true;
|
1737 | 1752 | }
|
1738 | 1753 |
|
1739 |
| -// |
1740 |
| -// Mark old keypool keys as used, |
1741 |
| -// and generate all new keys |
1742 |
| -// |
| 1754 | +/** |
| 1755 | + * Mark old keypool keys as used, |
| 1756 | + * and generate all new keys |
| 1757 | + */ |
1743 | 1758 | bool CWallet::NewKeyPool()
|
1744 | 1759 | {
|
1745 | 1760 | {
|
@@ -2120,6 +2135,7 @@ void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts)
|
2120 | 2135 | }
|
2121 | 2136 | }
|
2122 | 2137 |
|
| 2138 | +/** @} */ // end of Actions |
2123 | 2139 |
|
2124 | 2140 | class CAffectedKeysVisitor : public boost::static_visitor<void> {
|
2125 | 2141 | private:
|
|
0 commit comments