entry.push_back(Pair("confirmations", confirms));
if (wtx.IsCoinBase() || wtx.IsCoinStake())
entry.push_back(Pair("generated", true));
- if (confirms)
+ if (confirms > 0)
{
entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex()));
entry.push_back(Pair("blockindex", wtx.nIndex));
entry.push_back(Pair("blocktime", (boost::int64_t)(mapBlockIndex[wtx.hashBlock]->nTime)));
}
- entry.push_back(Pair("txid", wtx.GetHash().GetHex()));
+ uint256 hash = wtx.GetHash();
+ uint256 metahash = wtx.GetMetaHash();
+ entry.push_back(Pair("txid", hash.GetHex()));
+ entry.push_back(Pair("metahash", metahash.GetHex()));
+ Array conflicts;
+ BOOST_FOREACH(const uint256& conflict, wtx.GetConflicts())
+ conflicts.push_back(conflict.GetHex());
+ entry.push_back(Pair("walletconflicts", conflicts));
entry.push_back(Pair("time", (boost::int64_t)wtx.GetTxTime()));
entry.push_back(Pair("timereceived", (boost::int64_t)wtx.nTimeReceived));
BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue)
proxyType proxy;
GetProxy(NET_IPV4, proxy);
- Object obj;
+ Object obj, diff;
obj.push_back(Pair("version", FormatFullVersion()));
obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION));
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
obj.push_back(Pair("ip", addrSeenByPeer.ToStringIP()));
- obj.push_back(Pair("difficulty", (double)GetDifficulty()));
+
+ diff.push_back(Pair("proof-of-work", GetDifficulty()));
+ diff.push_back(Pair("proof-of-stake", GetDifficulty(GetLastBlockIndex(pindexBest, true))));
+ obj.push_back(Pair("difficulty", diff));
+
obj.push_back(Pair("testnet", fTestNet));
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
- if (!wtx.IsConfirmed())
+ if (!wtx.IsTrusted() || wtx.GetBlocksToMaturity() > 0)
continue;
int64 allGeneratedImmature, allGeneratedMature, allFee;
return ValueFromAmount(nBalance);
}
+Value getunconfirmedbalance(const Array ¶ms, bool fHelp)
+{
+ if (fHelp || params.size() > 0)
+ throw runtime_error(
+ "getunconfirmedbalance\n"
+ "Returns the server's total unconfirmed balance\n");
+ return ValueFromAmount(pwalletMain->GetUnconfirmedBalance());
+}
Value movecmd(const Array& params, bool fHelp)
{
Object entry;
entry.push_back(Pair("account", strSentAccount));
entry.push_back(Pair("address", CBitcoinAddress(s.first).ToString()));
- entry.push_back(Pair("category", "send"));
+
+ if (wtx.GetDepthInMainChain() < 0) {
+ entry.push_back(Pair("category", "conflicted"));
+ } else {
+ entry.push_back(Pair("category", "send"));
+ }
+
entry.push_back(Pair("amount", ValueFromAmount(-s.second)));
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
if (fLong)
else
entry.push_back(Pair("category", "generate"));
}
- else
- entry.push_back(Pair("category", "receive"));
+ else {
+ if (wtx.GetDepthInMainChain() < 0) {
+ entry.push_back(Pair("category", "conflicted"));
+ } else {
+ entry.push_back(Pair("category", "receive"));
+ }
+ }
entry.push_back(Pair("amount", ValueFromAmount(r.second)));
if (fLong)
WalletTxToJSON(wtx, entry);
string strSentAccount;
list<pair<CTxDestination, int64> > listReceived;
list<pair<CTxDestination, int64> > listSent;
+ if (wtx.GetBlocksToMaturity() > 0)
+ continue;
wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount);
mapAccountBalances[strSentAccount] -= nFee;
BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent)
Array details;
ListTransactions(pwalletMain->mapWallet[hash], "*", 0, false, details);
entry.push_back(Pair("details", details));
+
+ CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
+ ssTx << wtx;
+ string strHex = HexStr(ssTx.begin(), ssTx.end());
+ entry.push_back(Pair("hex", strHex));
}
else
{
CTransaction tx;
uint256 hashBlock = 0;
- if (GetTransaction(hash, tx, hashBlock))
+ if (GetTransaction(hash, tx, hashBlock, true))
{
- entry.push_back(Pair("txid", hash.GetHex()));
TxToJSON(tx, 0, entry);
if (hashBlock == 0)
entry.push_back(Pair("confirmations", 0));
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
- {
entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight));
- entry.push_back(Pair("txntime", (boost::int64_t)tx.nTime));
- entry.push_back(Pair("time", (boost::int64_t)pindex->nTime));
- }
else
entry.push_back(Pair("confirmations", 0));
}
return ret;
}
-// ppcoin: reserve balance from being staked for network protection
+// reserve balance from being staked for network protection
Value reservebalance(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 2)
}
-// ppcoin: check wallet integrity
+// check wallet integrity
Value checkwallet(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 0)
}
-// ppcoin: repair wallet
+// repair wallet
Value repairwallet(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 0)
return result;
}
-// NovaCoin: resend unconfirmed wallet transactions
+// resend unconfirmed wallet transactions
Value resendtx(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
return Value::null;
}
-// ppcoin: make a public-private key pair
+// make a public-private key pair
Value makekeypair(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
string strPrefix = "";
if (params.size() > 0)
strPrefix = params[0].get_str();
-
+
CKey key;
key.MakeNewKey(false);