obj.push_back(Pair("difficulty", (double)GetDifficulty()));
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")));
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
{
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;
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());