mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
replaced MINE_ with ISMINE_
This commit is contained in:
parent
53a2148f0c
commit
a3e192a327
@ -55,8 +55,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
|
||||
|
||||
int64_t nTime = wtx.GetTxTime();
|
||||
int64_t nCredit = wtx.GetCredit(MINE_ALL);
|
||||
int64_t nDebit = wtx.GetDebit(MINE_ALL);
|
||||
int64_t nCredit = wtx.GetCredit(ISMINE_ALL);
|
||||
int64_t nDebit = wtx.GetDebit(ISMINE_ALL);
|
||||
int64_t nNet = nCredit - nDebit;
|
||||
|
||||
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx);
|
||||
@ -98,7 +98,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||
strHTML += GUIUtil::HtmlEscape(rec->address);
|
||||
QString addressOwned = (::IsMine(*wallet, address) == MINE_SPENDABLE) ? tr("own address") : tr("watch-only");
|
||||
QString addressOwned = (::IsMine(*wallet, address) == ISMINE_SPENDABLE) ? tr("own address") : tr("watch-only");
|
||||
if (!wallet->mapAddressBook[address].name.empty())
|
||||
strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
|
||||
else
|
||||
@ -133,7 +133,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
//
|
||||
int64_t nUnmatured = 0;
|
||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
||||
nUnmatured += wallet->GetCredit(txout, MINE_ALL);
|
||||
nUnmatured += wallet->GetCredit(txout, ISMINE_ALL);
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> ";
|
||||
if (wtx.IsInMainChain())
|
||||
strHTML += BitcoinUnits::formatWithUnit(unit, nUnmatured)+ " (" + tr("matures in %n more block(s)", "", wtx.GetBlocksToMaturity()) + ")";
|
||||
@ -150,14 +150,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
}
|
||||
else
|
||||
{
|
||||
isminetype fAllFromMe = MINE_SPENDABLE;
|
||||
isminetype fAllFromMe = ISMINE_SPENDABLE;
|
||||
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
||||
{
|
||||
isminetype mine = wallet->IsMine(txin);
|
||||
if(fAllFromMe > mine) fAllFromMe = mine;
|
||||
}
|
||||
|
||||
isminetype fAllToMe = MINE_SPENDABLE;
|
||||
isminetype fAllToMe = ISMINE_SPENDABLE;
|
||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
||||
{
|
||||
isminetype mine = wallet->IsMine(txout);
|
||||
@ -166,7 +166,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
|
||||
if (fAllFromMe)
|
||||
{
|
||||
if(fAllFromMe == MINE_WATCH_ONLY)
|
||||
if(fAllFromMe == ISMINE_WATCH_ONLY)
|
||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("watch-only") + "<br>";
|
||||
|
||||
//
|
||||
@ -176,7 +176,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
{
|
||||
// Ignore change
|
||||
isminetype toSelf = wallet->IsMine(txout);
|
||||
if ((toSelf == MINE_SPENDABLE) && (fAllFromMe == MINE_SPENDABLE))
|
||||
if ((toSelf == ISMINE_SPENDABLE) && (fAllFromMe == ISMINE_SPENDABLE))
|
||||
continue;
|
||||
|
||||
if (!wtx.mapValue.count("to") || wtx.mapValue["to"].empty())
|
||||
@ -189,9 +189,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
|
||||
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
|
||||
strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
|
||||
if(toSelf == MINE_SPENDABLE)
|
||||
if(toSelf == ISMINE_SPENDABLE)
|
||||
strHTML += " (own address)";
|
||||
else if(toSelf == MINE_WATCH_ONLY)
|
||||
else if(toSelf == ISMINE_WATCH_ONLY)
|
||||
strHTML += " (watch-only)";
|
||||
strHTML += "<br>";
|
||||
}
|
||||
@ -222,10 +222,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
//
|
||||
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
||||
if (wallet->IsMine(txin))
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, MINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, ISMINE_ALL)) + "<br>";
|
||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
||||
if (wallet->IsMine(txout))
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, MINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, ISMINE_ALL)) + "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,10 +275,10 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
strHTML += "<hr><br>" + tr("Debug information") + "<br><br>";
|
||||
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
||||
if(wallet->IsMine(txin))
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, MINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, -wallet->GetDebit(txin, ISMINE_ALL)) + "<br>";
|
||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
||||
if(wallet->IsMine(txout))
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, MINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatWithUnit(unit, wallet->GetCredit(txout, ISMINE_ALL)) + "<br>";
|
||||
|
||||
strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
|
||||
strHTML += GUIUtil::HtmlEscape(wtx.ToString(), true);
|
||||
@ -305,8 +305,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
strHTML += QString::fromStdString(CBitcoinAddress(address).ToString());
|
||||
}
|
||||
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatWithUnit(unit, vout.nValue);
|
||||
strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) & MINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
|
||||
strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(vout) & MINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
|
||||
strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
|
||||
strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||
QList<TransactionRecord> parts;
|
||||
int64_t nTime = wtx.GetTxTime();
|
||||
int64_t nCredit = wtx.GetCredit(true);
|
||||
int64_t nDebit = wtx.GetDebit(MINE_ALL);
|
||||
int64_t nDebit = wtx.GetDebit(ISMINE_ALL);
|
||||
int64_t nNet = nCredit - nDebit;
|
||||
uint256 hash = wtx.GetHash();
|
||||
std::map<std::string, std::string> mapValue = wtx.mapValue;
|
||||
@ -52,7 +52,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||
CTxDestination address;
|
||||
sub.idx = parts.size(); // sequence number
|
||||
sub.credit = txout.nValue;
|
||||
sub.involvesWatchAddress = mine == MINE_WATCH_ONLY;
|
||||
sub.involvesWatchAddress = mine == ISMINE_WATCH_ONLY;
|
||||
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))
|
||||
{
|
||||
// Received by Bitcoin Address
|
||||
@ -78,19 +78,19 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||
else
|
||||
{
|
||||
bool involvesWatchAddress = false;
|
||||
isminetype fAllFromMe = MINE_SPENDABLE;
|
||||
isminetype fAllFromMe = ISMINE_SPENDABLE;
|
||||
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
||||
{
|
||||
isminetype mine = wallet->IsMine(txin);
|
||||
if(mine == MINE_WATCH_ONLY) involvesWatchAddress = true;
|
||||
if(mine == ISMINE_WATCH_ONLY) involvesWatchAddress = true;
|
||||
if(fAllFromMe > mine) fAllFromMe = mine;
|
||||
}
|
||||
|
||||
isminetype fAllToMe = MINE_SPENDABLE;
|
||||
isminetype fAllToMe = ISMINE_SPENDABLE;
|
||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
||||
{
|
||||
isminetype mine = wallet->IsMine(txout);
|
||||
if(mine == MINE_WATCH_ONLY) involvesWatchAddress = true;
|
||||
if(mine == ISMINE_WATCH_ONLY) involvesWatchAddress = true;
|
||||
if(fAllToMe > mine) fAllToMe = mine;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
Object obj;
|
||||
CPubKey vchPubKey;
|
||||
obj.push_back(Pair("isscript", false));
|
||||
if (mine == MINE_SPENDABLE) {
|
||||
if (mine == ISMINE_SPENDABLE) {
|
||||
pwalletMain->GetPubKey(keyID, vchPubKey);
|
||||
obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
|
||||
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
|
||||
@ -115,7 +115,7 @@ public:
|
||||
Object operator()(const CScriptID &scriptID) const {
|
||||
Object obj;
|
||||
obj.push_back(Pair("isscript", true));
|
||||
if (mine != MINE_NO) {
|
||||
if (mine != ISMINE_NO) {
|
||||
CScript subscript;
|
||||
pwalletMain->GetCScript(scriptID, subscript);
|
||||
std::vector<CTxDestination> addresses;
|
||||
@ -170,10 +170,10 @@ Value validateaddress(const Array& params, bool fHelp)
|
||||
string currentAddress = address.ToString();
|
||||
ret.push_back(Pair("address", currentAddress));
|
||||
#ifdef ENABLE_WALLET
|
||||
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : MINE_NO;
|
||||
ret.push_back(Pair("ismine", (mine & MINE_SPENDABLE) ? true : false));
|
||||
if (mine != MINE_NO) {
|
||||
ret.push_back(Pair("iswatchonly", (mine & MINE_WATCH_ONLY) ? true: false));
|
||||
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
|
||||
ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));
|
||||
if (mine != ISMINE_NO) {
|
||||
ret.push_back(Pair("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true: false));
|
||||
Object detail = boost::apply_visitor(DescribeAddressVisitor(mine), dest);
|
||||
ret.insert(ret.end(), detail.begin(), detail.end());
|
||||
}
|
||||
|
@ -623,10 +623,10 @@ Value getbalance(const Array& params, bool fHelp)
|
||||
int nMinDepth = 1;
|
||||
if (params.size() > 1)
|
||||
nMinDepth = params[1].get_int();
|
||||
isminefilter filter = MINE_SPENDABLE;
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
if(params.size() > 2)
|
||||
if(params[2].get_bool())
|
||||
filter = filter | MINE_WATCH_ONLY;
|
||||
filter = filter | ISMINE_WATCH_ONLY;
|
||||
|
||||
if (params[0].get_str() == "*") {
|
||||
// Calculate total balance a different way from GetBalance()
|
||||
@ -786,7 +786,7 @@ Value sendfrom(const Array& params, bool fHelp)
|
||||
EnsureWalletIsUnlocked();
|
||||
|
||||
// Check funds
|
||||
int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, MINE_SPENDABLE);
|
||||
int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
||||
if (nAmount > nBalance)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
||||
|
||||
@ -863,7 +863,7 @@ Value sendmany(const Array& params, bool fHelp)
|
||||
EnsureWalletIsUnlocked();
|
||||
|
||||
// Check funds
|
||||
int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, MINE_SPENDABLE);
|
||||
int64_t nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE);
|
||||
if (totalAmount > nBalance)
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
|
||||
|
||||
@ -953,10 +953,10 @@ Value ListReceived(const Array& params, bool fByAccounts)
|
||||
if (params.size() > 1)
|
||||
fIncludeEmpty = params[1].get_bool();
|
||||
|
||||
isminefilter filter = MINE_SPENDABLE;
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
if(params.size() > 2)
|
||||
if(params[2].get_bool())
|
||||
filter = filter | MINE_WATCH_ONLY;
|
||||
filter = filter | ISMINE_WATCH_ONLY;
|
||||
|
||||
// Tally
|
||||
map<CBitcoinAddress, tallyitem> mapTally;
|
||||
@ -985,7 +985,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
|
||||
item.nAmount += txout.nValue;
|
||||
item.nConf = min(item.nConf, nDepth);
|
||||
item.txids.push_back(wtx.GetHash());
|
||||
if (mine & MINE_WATCH_ONLY)
|
||||
if (mine & ISMINE_WATCH_ONLY)
|
||||
item.fIsWatchonly = true;
|
||||
}
|
||||
}
|
||||
@ -1139,7 +1139,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
||||
wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount, filter);
|
||||
|
||||
bool fAllAccounts = (strAccount == string("*"));
|
||||
bool involvesWatchonly = wtx.IsFromMe(MINE_WATCH_ONLY);
|
||||
bool involvesWatchonly = wtx.IsFromMe(ISMINE_WATCH_ONLY);
|
||||
|
||||
// Sent
|
||||
if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
|
||||
@ -1147,7 +1147,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
||||
BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64_t)& s, listSent)
|
||||
{
|
||||
Object entry;
|
||||
if(involvesWatchonly || (::IsMine(*pwalletMain, s.first) & MINE_WATCH_ONLY))
|
||||
if(involvesWatchonly || (::IsMine(*pwalletMain, s.first) & ISMINE_WATCH_ONLY))
|
||||
entry.push_back(Pair("involvesWatchonly", true));
|
||||
entry.push_back(Pair("account", strSentAccount));
|
||||
MaybePushAddress(entry, s.first);
|
||||
@ -1171,7 +1171,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
||||
if (fAllAccounts || (account == strAccount))
|
||||
{
|
||||
Object entry;
|
||||
if(involvesWatchonly || (::IsMine(*pwalletMain, r.first) & MINE_WATCH_ONLY))
|
||||
if(involvesWatchonly || (::IsMine(*pwalletMain, r.first) & ISMINE_WATCH_ONLY))
|
||||
entry.push_back(Pair("involvesWatchonly", true));
|
||||
entry.push_back(Pair("account", account));
|
||||
MaybePushAddress(entry, r.first);
|
||||
@ -1285,10 +1285,10 @@ Value listtransactions(const Array& params, bool fHelp)
|
||||
int nFrom = 0;
|
||||
if (params.size() > 2)
|
||||
nFrom = params[2].get_int();
|
||||
isminefilter filter = MINE_SPENDABLE;
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
if(params.size() > 3)
|
||||
if(params[3].get_bool())
|
||||
filter = filter | MINE_WATCH_ONLY;
|
||||
filter = filter | ISMINE_WATCH_ONLY;
|
||||
|
||||
if (nCount < 0)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative count");
|
||||
@ -1359,10 +1359,10 @@ Value listaccounts(const Array& params, bool fHelp)
|
||||
int nMinDepth = 1;
|
||||
if (params.size() > 0)
|
||||
nMinDepth = params[0].get_int();
|
||||
isminefilter includeWatchonly = MINE_SPENDABLE;
|
||||
isminefilter includeWatchonly = ISMINE_SPENDABLE;
|
||||
if(params.size() > 1)
|
||||
if(params[1].get_bool())
|
||||
includeWatchonly = includeWatchonly | MINE_WATCH_ONLY;
|
||||
includeWatchonly = includeWatchonly | ISMINE_WATCH_ONLY;
|
||||
|
||||
map<string, int64_t> mapAccountBalances;
|
||||
BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& entry, pwalletMain->mapAddressBook) {
|
||||
@ -1451,7 +1451,7 @@ Value listsinceblock(const Array& params, bool fHelp)
|
||||
|
||||
CBlockIndex *pindex = NULL;
|
||||
int target_confirms = 1;
|
||||
isminefilter filter = MINE_SPENDABLE;
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
|
||||
if (params.size() > 0)
|
||||
{
|
||||
@ -1473,7 +1473,7 @@ Value listsinceblock(const Array& params, bool fHelp)
|
||||
|
||||
if(params.size() > 2)
|
||||
if(params[2].get_bool())
|
||||
filter = filter | MINE_WATCH_ONLY;
|
||||
filter = filter | ISMINE_WATCH_ONLY;
|
||||
|
||||
int depth = pindex ? (1 + chainActive.Height() - pindex->nHeight) : -1;
|
||||
|
||||
@ -1542,10 +1542,10 @@ Value gettransaction(const Array& params, bool fHelp)
|
||||
uint256 hash;
|
||||
hash.SetHex(params[0].get_str());
|
||||
|
||||
isminefilter filter = MINE_SPENDABLE;
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
if(params.size() > 1)
|
||||
if(params[1].get_bool())
|
||||
filter = filter | MINE_WATCH_ONLY;
|
||||
filter = filter | ISMINE_WATCH_ONLY;
|
||||
|
||||
Object entry;
|
||||
if (!pwalletMain->mapWallet.count(hash))
|
||||
|
@ -1469,8 +1469,8 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
|
||||
txnouttype whichType;
|
||||
if (!Solver(scriptPubKey, whichType, vSolutions)) {
|
||||
if (keystore.HaveWatchOnly(scriptPubKey))
|
||||
return MINE_WATCH_ONLY;
|
||||
return MINE_NO;
|
||||
return ISMINE_WATCH_ONLY;
|
||||
return ISMINE_NO;
|
||||
}
|
||||
|
||||
CKeyID keyID;
|
||||
@ -1482,12 +1482,12 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
|
||||
case TX_PUBKEY:
|
||||
keyID = CPubKey(vSolutions[0]).GetID();
|
||||
if (keystore.HaveKey(keyID))
|
||||
return MINE_SPENDABLE;
|
||||
return ISMINE_SPENDABLE;
|
||||
break;
|
||||
case TX_PUBKEYHASH:
|
||||
keyID = CKeyID(uint160(vSolutions[0]));
|
||||
if (keystore.HaveKey(keyID))
|
||||
return MINE_SPENDABLE;
|
||||
return ISMINE_SPENDABLE;
|
||||
break;
|
||||
case TX_SCRIPTHASH:
|
||||
{
|
||||
@ -1495,7 +1495,7 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
|
||||
CScript subscript;
|
||||
if (keystore.GetCScript(scriptID, subscript)) {
|
||||
isminetype ret = IsMine(keystore, subscript);
|
||||
if (ret == MINE_SPENDABLE)
|
||||
if (ret == ISMINE_SPENDABLE)
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
@ -1509,14 +1509,14 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
|
||||
// in shared-wallet situations.
|
||||
vector<valtype> keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1);
|
||||
if (HaveKeys(keys, keystore) == keys.size())
|
||||
return MINE_SPENDABLE;
|
||||
return ISMINE_SPENDABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (keystore.HaveWatchOnly(scriptPubKey))
|
||||
return MINE_WATCH_ONLY;
|
||||
return MINE_NO;
|
||||
return ISMINE_WATCH_ONLY;
|
||||
return ISMINE_NO;
|
||||
}
|
||||
|
||||
bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
|
||||
|
@ -197,10 +197,10 @@ enum
|
||||
/** IsMine() return codes */
|
||||
enum isminetype
|
||||
{
|
||||
MINE_NO = 0,
|
||||
MINE_WATCH_ONLY = 1,
|
||||
MINE_SPENDABLE = 2,
|
||||
MINE_ALL = MINE_WATCH_ONLY | MINE_SPENDABLE
|
||||
ISMINE_NO = 0,
|
||||
ISMINE_WATCH_ONLY = 1,
|
||||
ISMINE_SPENDABLE = 2,
|
||||
ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE
|
||||
};
|
||||
/** used for bitflags of isminetype */
|
||||
typedef uint8_t isminefilter;
|
||||
|
@ -707,7 +707,7 @@ isminetype CWallet::IsMine(const CTxIn &txin) const
|
||||
return IsMine(prev.vout[txin.prevout.n]);
|
||||
}
|
||||
}
|
||||
return MINE_NO;
|
||||
return ISMINE_NO;
|
||||
}
|
||||
|
||||
int64_t CWallet::GetDebit(const CTxIn &txin, const isminefilter& filter) const
|
||||
@ -1139,10 +1139,10 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
||||
|
||||
for (unsigned int i = 0; i < pcoin->vout.size(); i++) {
|
||||
isminetype mine = IsMine(pcoin->vout[i]);
|
||||
if (!(IsSpent(wtxid, i)) && mine != MINE_NO &&
|
||||
if (!(IsSpent(wtxid, i)) && mine != ISMINE_NO &&
|
||||
!IsLockedCoin((*it).first, i) && pcoin->vout[i].nValue > 0 &&
|
||||
(!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i)))
|
||||
vCoins.push_back(COutput(pcoin, i, nDepth, mine & MINE_SPENDABLE));
|
||||
vCoins.push_back(COutput(pcoin, i, nDepth, mine & ISMINE_SPENDABLE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1216,7 +1216,7 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, int nConfMine, int nConfT
|
||||
|
||||
const CWalletTx *pcoin = output.tx;
|
||||
|
||||
if (output.nDepth < (pcoin->IsFromMe(MINE_ALL) ? nConfMine : nConfTheirs))
|
||||
if (output.nDepth < (pcoin->IsFromMe(ISMINE_ALL) ? nConfMine : nConfTheirs))
|
||||
continue;
|
||||
|
||||
int i = output.i;
|
||||
@ -1845,7 +1845,7 @@ std::map<CTxDestination, int64_t> CWallet::GetAddressBalances()
|
||||
continue;
|
||||
|
||||
int nDepth = pcoin->GetDepthInMainChain();
|
||||
if (nDepth < (pcoin->IsFromMe(MINE_ALL) ? 0 : 1))
|
||||
if (nDepth < (pcoin->IsFromMe(ISMINE_ALL) ? 0 : 1))
|
||||
continue;
|
||||
|
||||
for (unsigned int i = 0; i < pcoin->vout.size(); i++)
|
||||
|
24
src/wallet.h
24
src/wallet.h
@ -315,7 +315,7 @@ public:
|
||||
}
|
||||
bool IsFromMe(const CTransaction& tx) const // should probably be renamed to IsRelevantToMe
|
||||
{
|
||||
return (GetDebit(tx, MINE_ALL) > 0);
|
||||
return (GetDebit(tx, ISMINE_ALL) > 0);
|
||||
}
|
||||
bool IsConflicting(const CTransaction& tx) const
|
||||
{
|
||||
@ -621,24 +621,24 @@ public:
|
||||
return 0;
|
||||
|
||||
int64_t debit = 0;
|
||||
if(filter & MINE_SPENDABLE)
|
||||
if(filter & ISMINE_SPENDABLE)
|
||||
{
|
||||
if (fDebitCached)
|
||||
debit += nDebitCached;
|
||||
else
|
||||
{
|
||||
nDebitCached = pwallet->GetDebit(*this, MINE_SPENDABLE);
|
||||
nDebitCached = pwallet->GetDebit(*this, ISMINE_SPENDABLE);
|
||||
fDebitCached = true;
|
||||
debit += nDebitCached;
|
||||
}
|
||||
}
|
||||
if(filter & MINE_WATCH_ONLY)
|
||||
if(filter & ISMINE_WATCH_ONLY)
|
||||
{
|
||||
if(fWatchDebitCached)
|
||||
debit += nWatchDebitCached;
|
||||
else
|
||||
{
|
||||
nWatchDebitCached = pwallet->GetDebit(*this, MINE_WATCH_ONLY);
|
||||
nWatchDebitCached = pwallet->GetDebit(*this, ISMINE_WATCH_ONLY);
|
||||
fWatchDebitCached = true;
|
||||
debit += nWatchDebitCached;
|
||||
}
|
||||
@ -655,7 +655,7 @@ public:
|
||||
// GetBalance can assume transactions in mapWallet won't change
|
||||
if (fUseCache && fCreditCached)
|
||||
return nCreditCached;
|
||||
nCreditCached = pwallet->GetCredit(*this, MINE_ALL);
|
||||
nCreditCached = pwallet->GetCredit(*this, ISMINE_ALL);
|
||||
fCreditCached = true;
|
||||
return nCreditCached;
|
||||
}
|
||||
@ -666,7 +666,7 @@ public:
|
||||
{
|
||||
if (fUseCache && fImmatureCreditCached)
|
||||
return nImmatureCreditCached;
|
||||
nImmatureCreditCached = pwallet->GetCredit(*this, MINE_SPENDABLE);
|
||||
nImmatureCreditCached = pwallet->GetCredit(*this, ISMINE_SPENDABLE);
|
||||
fImmatureCreditCached = true;
|
||||
return nImmatureCreditCached;
|
||||
}
|
||||
@ -693,7 +693,7 @@ public:
|
||||
if (!pwallet->IsSpent(hashTx, i))
|
||||
{
|
||||
const CTxOut &txout = vout[i];
|
||||
nCredit += pwallet->GetCredit(txout, MINE_SPENDABLE);
|
||||
nCredit += pwallet->GetCredit(txout, ISMINE_SPENDABLE);
|
||||
if (!MoneyRange(nCredit))
|
||||
throw std::runtime_error("CWalletTx::GetAvailableCredit() : value out of range");
|
||||
}
|
||||
@ -710,7 +710,7 @@ public:
|
||||
{
|
||||
if (fUseCache && fImmatureWatchCreditCached)
|
||||
return nImmatureWatchCreditCached;
|
||||
nImmatureWatchCreditCached = pwallet->GetCredit(*this, MINE_WATCH_ONLY);
|
||||
nImmatureWatchCreditCached = pwallet->GetCredit(*this, ISMINE_WATCH_ONLY);
|
||||
fImmatureWatchCreditCached = true;
|
||||
return nImmatureWatchCreditCached;
|
||||
}
|
||||
@ -736,7 +736,7 @@ public:
|
||||
if (!pwallet->IsSpent(GetHash(), i))
|
||||
{
|
||||
const CTxOut &txout = vout[i];
|
||||
nCredit += pwallet->GetCredit(txout, MINE_WATCH_ONLY);
|
||||
nCredit += pwallet->GetCredit(txout, ISMINE_WATCH_ONLY);
|
||||
if (!MoneyRange(nCredit))
|
||||
throw std::runtime_error("CWalletTx::GetAvailableCredit() : value out of range");
|
||||
}
|
||||
@ -777,7 +777,7 @@ public:
|
||||
return true;
|
||||
if (nDepth < 0)
|
||||
return false;
|
||||
if (!bSpendZeroConfChange || !IsFromMe(MINE_ALL)) // using wtx's cached debit
|
||||
if (!bSpendZeroConfChange || !IsFromMe(ISMINE_ALL)) // using wtx's cached debit
|
||||
return false;
|
||||
|
||||
// Trusted if all inputs are from us and are in the mempool:
|
||||
@ -788,7 +788,7 @@ public:
|
||||
if (parent == NULL)
|
||||
return false;
|
||||
const CTxOut& parentOut = parent->vout[txin.prevout.n];
|
||||
if (pwallet->IsMine(parentOut) != MINE_SPENDABLE)
|
||||
if (pwallet->IsMine(parentOut) != ISMINE_SPENDABLE)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user