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