Skip to content

Commit 519dd1c

Browse files
Added MINE_ALL = (spendable|watchonly)
1 parent 23b0506 commit 519dd1c

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

src/qt/transactiondesc.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
5555
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
5656

5757
int64_t nTime = wtx.GetTxTime();
58-
int64_t nCredit = wtx.GetCredit(MINE_SPENDABLE|MINE_WATCH_ONLY);
59-
int64_t nDebit = wtx.GetDebit(MINE_SPENDABLE|MINE_WATCH_ONLY);
58+
int64_t nCredit = wtx.GetCredit(MINE_ALL);
59+
int64_t nDebit = wtx.GetDebit(MINE_ALL);
6060
int64_t nNet = nCredit - nDebit;
6161

6262
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
@@ -133,7 +133,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
133133
//
134134
int64_t nUnmatured = 0;
135135
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
136-
nUnmatured += wallet->GetCredit(txout, MINE_SPENDABLE|MINE_WATCH_ONLY);
136+
nUnmatured += wallet->GetCredit(txout, MINE_ALL);
137137
strHTML += "<b>" + tr("Credit") + ":</b> ";
138138
if (wtx.IsInMainChain())
139139
strHTML += BitcoinUnits::formatWithUnit(unit, nUnmatured)+ " (" + tr("matures in %n more block(s)", "", wtx.GetBlocksToMaturity()) + ")";
@@ -222,10 +222,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
222222
//
223223
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
224224
if (wallet->IsMine(txin))
225-
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, MINE_SPENDABLE|MINE_WATCH_ONLY)) + "<br>";
225+
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, MINE_ALL)) + "<br>";
226226
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
227227
if (wallet->IsMine(txout))
228-
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, MINE_SPENDABLE|MINE_WATCH_ONLY)) + "<br>";
228+
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, MINE_ALL)) + "<br>";
229229
}
230230
}
231231

@@ -275,10 +275,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
275275
strHTML += "<hr><br>" + tr("Debug information") + "<br><br>";
276276
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
277277
if(wallet->IsMine(txin))
278-
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, MINE_SPENDABLE|MINE_WATCH_ONLY)) + "<br>";
278+
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, MINE_ALL)) + "<br>";
279279
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
280280
if(wallet->IsMine(txout))
281-
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, MINE_SPENDABLE|MINE_WATCH_ONLY)) + "<br>";
281+
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, MINE_ALL)) + "<br>";
282282

283283
strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
284284
strHTML += GUIUtil::HtmlEscape(wtx.ToString(), true);

src/qt/transactionrecord.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
3333
QList<TransactionRecord> parts;
3434
int64_t nTime = wtx.GetTxTime();
3535
int64_t nCredit = wtx.GetCredit(true);
36-
int64_t nDebit = wtx.GetDebit(MINE_SPENDABLE|MINE_WATCH_ONLY);
36+
int64_t nDebit = wtx.GetDebit(MINE_ALL);
3737
int64_t nNet = nCredit - nDebit;
3838
uint256 hash = wtx.GetHash();
3939
std::map<std::string, std::string> mapValue = wtx.mapValue;

src/script.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ enum isminetype
200200
MINE_NO = 0,
201201
MINE_WATCH_ONLY = 1,
202202
MINE_SPENDABLE = 2,
203+
MINE_ALL = MINE_WATCH_ONLY | MINE_SPENDABLE
203204
};
204205
/** used for bitflags of isminetype */
205206
typedef uint8_t isminefilter;

src/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, int nConfMine, int nConfT
12161216

12171217
const CWalletTx *pcoin = output.tx;
12181218

1219-
if (output.nDepth < (pcoin->IsFromMe(MINE_SPENDABLE|MINE_WATCH_ONLY) ? nConfMine : nConfTheirs))
1219+
if (output.nDepth < (pcoin->IsFromMe(MINE_ALL) ? nConfMine : nConfTheirs))
12201220
continue;
12211221

12221222
int i = output.i;
@@ -1845,7 +1845,7 @@ std::map<CTxDestination, int64_t> CWallet::GetAddressBalances()
18451845
continue;
18461846

18471847
int nDepth = pcoin->GetDepthInMainChain();
1848-
if (nDepth < (pcoin->IsFromMe(MINE_SPENDABLE|MINE_WATCH_ONLY) ? 0 : 1))
1848+
if (nDepth < (pcoin->IsFromMe(MINE_ALL) ? 0 : 1))
18491849
continue;
18501850

18511851
for (unsigned int i = 0; i < pcoin->vout.size(); i++)

src/wallet.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface
315315
}
316316
bool IsFromMe(const CTransaction& tx) const // should probably be renamed to IsRelevantToMe
317317
{
318-
return (GetDebit(tx, MINE_SPENDABLE|MINE_WATCH_ONLY) > 0);
318+
return (GetDebit(tx, MINE_ALL) > 0);
319319
}
320320
bool IsConflicting(const CTransaction& tx) const
321321
{
@@ -655,7 +655,7 @@ class CWalletTx : public CMerkleTx
655655
// GetBalance can assume transactions in mapWallet won't change
656656
if (fUseCache && fCreditCached)
657657
return nCreditCached;
658-
nCreditCached = pwallet->GetCredit(*this, MINE_SPENDABLE|MINE_WATCH_ONLY);
658+
nCreditCached = pwallet->GetCredit(*this, MINE_ALL);
659659
fCreditCached = true;
660660
return nCreditCached;
661661
}
@@ -777,7 +777,7 @@ class CWalletTx : public CMerkleTx
777777
return true;
778778
if (nDepth < 0)
779779
return false;
780-
if (!bSpendZeroConfChange || !IsFromMe(MINE_SPENDABLE|MINE_WATCH_ONLY)) // using wtx's cached debit
780+
if (!bSpendZeroConfChange || !IsFromMe(MINE_ALL)) // using wtx's cached debit
781781
return false;
782782

783783
// Trusted if all inputs are from us and are in the mempool:

0 commit comments

Comments
 (0)