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", pwalletMain->GetKeyPoolSize()));
+ obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
+ obj.push_back(Pair("mininput", ValueFromAmount(nMinimumInputValue)));
if (pwalletMain->IsCrypted())
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime / 1000));
obj.push_back(Pair("errors", GetWarnings("statusbar")));
if (fHelp || params.size() < 2 || params.size() > 4)
throw runtime_error(
"sendtoaddress <novacoinaddress> <amount> [comment] [comment-to]\n"
- "<amount> is a real and is rounded to the nearest 0.000001"
+ "<amount> is a real and is rounded to the nearest " + FormatMoney(MIN_TXOUT_AMOUNT)
+ HelpRequiringPassphrase());
CBitcoinAddress address(params[0].get_str());
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())
continue;
int64 allGeneratedImmature, allGeneratedMature, allFee;
if (fHelp || params.size() < 3 || params.size() > 6)
throw runtime_error(
"sendfrom <fromaccount> <tonovacoinaddress> <amount> [minconf=1] [comment] [comment-to]\n"
- "<amount> is a real and is rounded to the nearest 0.000001"
+ "<amount> is a real and is rounded to the nearest " + FormatMoney(MIN_TXOUT_AMOUNT)
+ HelpRequiringPassphrase());
string strAccount = AccountFromValue(params[0]);
return CBitcoinAddress(innerID).ToString();
}
+Value addredeemscript(const Array& params, bool fHelp)
+{
+ if (fHelp || params.size() < 1 || params.size() > 2)
+ {
+ string msg = "addredeemscript <redeemScript> [account]\n"
+ "Add a P2SH address with a specified redeemScript to the wallet.\n"
+ "If [account] is specified, assign address to [account].";
+ throw runtime_error(msg);
+ }
+
+ string strAccount;
+ if (params.size() > 1)
+ strAccount = AccountFromValue(params[1]);
+
+ // Construct using pay-to-script-hash:
+ vector<unsigned char> innerData = ParseHexV(params[0], "redeemScript");
+ CScript inner(innerData.begin(), innerData.end());
+ CScriptID innerID = inner.GetID();
+ pwalletMain->AddCScript(inner);
+
+ pwalletMain->SetAddressBookName(innerID, strAccount);
+ return CBitcoinAddress(innerID).ToString();
+}
struct tallyitem
{
return ListReceived(params, true);
}
+static void MaybePushAddress(Object & entry, const CTxDestination &dest)
+{
+ CBitcoinAddress addr;
+ if (addr.Set(dest))
+ entry.push_back(Pair("address", addr.ToString()));
+}
+
void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, Array& ret)
{
int64 nGeneratedImmature, nGeneratedMature, nFee;
{
Object entry;
entry.push_back(Pair("account", strSentAccount));
- entry.push_back(Pair("address", CBitcoinAddress(s.first).ToString()));
- entry.push_back(Pair("category", "send"));
+ MaybePushAddress(entry, s.first);
+
+ 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)
{
Object entry;
entry.push_back(Pair("account", account));
- entry.push_back(Pair("address", CBitcoinAddress(r.first).ToString()));
+ MaybePushAddress(entry, r.first);
if (wtx.IsCoinBase())
{
if (wtx.GetDepthInMainChain() < 1)
uint256 hashBlock = 0;
if (GetTransaction(hash, tx, hashBlock))
{
- 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));
}
Value keypoolrefill(const Array& params, bool fHelp)
{
- if (fHelp || params.size() > 0)
+ if (fHelp || params.size() > 1)
throw runtime_error(
- "keypoolrefill\n"
+ "keypoolrefill [new-size]\n"
"Fills the keypool."
+ HelpRequiringPassphrase());
+ unsigned int nSize = max(GetArg("-keypool", 100), 0LL);
+ if (params.size() > 0) {
+ if (params[0].get_int() < 0)
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size");
+ nSize = (unsigned int) params[0].get_int();
+ }
+
EnsureWalletIsUnlocked();
- pwalletMain->TopUpKeyPool();
+ pwalletMain->TopUpKeyPool(nSize);
- if (pwalletMain->GetKeyPoolSize() < GetArg("-keypool", 100))
+ if (pwalletMain->GetKeyPoolSize() < nSize)
throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool.");
return Value::null;
void ThreadTopUpKeyPool(void* parg)
{
// Make this thread recognisable as the key-topping-up thread
- RenameThread("bitcoin-key-top");
+ RenameThread("novacoin-key-top");
pwalletMain->TopUpKeyPool();
}
void ThreadCleanWalletPassphrase(void* parg)
{
// Make this thread recognisable as the wallet relocking thread
- RenameThread("bitcoin-lock-wa");
+ RenameThread("novacoin-lock-wa");
int64 nMyWakeTime = GetTimeMillis() + *((int64*)parg) * 1000;
int nRequired;
ExtractDestinations(subscript, whichType, addresses, nRequired);
obj.push_back(Pair("script", GetTxnOutputType(whichType)));
+ obj.push_back(Pair("hex", HexStr(subscript.begin(), subscript.end())));
Array a;
BOOST_FOREACH(const CTxDestination& addr, addresses)
a.push_back(CBitcoinAddress(addr).ToString());