#include "net.h"
#include "init.h"
#include "ui_interface.h"
+#include "bitcoinrpc.h"
#undef printf
#include <boost/asio.hpp>
#include <boost/filesystem/fstream.hpp>
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
-#include "json/json_spirit_reader_template.h"
-#include "json/json_spirit_writer_template.h"
-#include "json/json_spirit_utils.h"
#define printf OutputDebugStringF
// MinGW 3.4.5 gets "fatal error: had to relocate PCH" if the json headers are
// precompiled in headers.h. The problem might be when the pch file goes over
using namespace json_spirit;
void ThreadRPCServer2(void* parg);
-typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
-
-class CRPCCommand
-{
-public:
- string name;
- rpcfn_type actor;
- bool okSafeMode;
-};
-
-class CRPCTable
-{
-private:
- map<string, const CRPCCommand*> mapCommands;
-public:
- CRPCTable();
- const CRPCCommand* operator[](string name) const;
- string help(string name) const;
-};
-
-const CRPCTable tableRPC;
static std::string strRPCUserColonPass;
strAccount = AccountFromValue(params[2]);
// Gather public keys
- if (nRequired < 1 || keys.size() < nRequired)
+ if (nRequired < 1)
+ throw runtime_error("a multisignature address must require at least one key to redeem");
+ if ((int)keys.size() < nRequired)
throw runtime_error(
- strprintf("wrong number of keys"
- "(got %d, need at least %d)", keys.size(), nRequired));
+ strprintf("not enough keys supplied "
+ "(got %d keys, but need at least %d to redeem)", keys.size(), nRequired));
std::vector<CKey> pubkeys;
pubkeys.resize(keys.size());
for (unsigned int i = 0; i < keys.size(); i++)
}
// ret is newest to oldest
- if (nFrom > ret.size()) nFrom = ret.size();
- if (nFrom+nCount > ret.size()) nCount = ret.size()-nFrom;
+ if (nFrom > (int)ret.size())
+ nFrom = ret.size();
+ if ((nFrom + nCount) > (int)ret.size())
+ nCount = ret.size() - nFrom;
Array::iterator first = ret.begin();
std::advance(first, nFrom);
Array::iterator last = ret.begin();
{
if (fHelp)
throw runtime_error(
- "listsinceblock [blockid] [target-confirmations]\n"
- "Get all transactions in blocks since block [blockid], or all transactions if omitted");
+ "listsinceblock [blockhash] [target-confirmations]\n"
+ "Get all transactions in blocks since block [blockhash], or all transactions if omitted");
CBlockIndex *pindex = NULL;
int target_confirms = 1;
if (target_confirms == 1)
{
- printf("oops!\n");
lastblock = hashBestChain;
}
else
//
-static CRPCCommand vRPCCommands[] =
+static const CRPCCommand vRPCCommands[] =
{ // name function safe mode?
// ------------------------ ----------------------- ----------
{ "help", &help, true },
unsigned int vcidx;
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++)
{
- CRPCCommand *pcmd;
+ const CRPCCommand *pcmd;
pcmd = &vRPCCommands[vcidx];
mapCommands[pcmd->name] = pcmd;
// Read header
int nLen = ReadHTTPHeader(stream, mapHeadersRet);
- if (nLen < 0 || nLen > MAX_SIZE)
+ if (nLen < 0 || nLen > (int)MAX_SIZE)
return 500;
// Read message
return 0;
}
#endif
+
+const CRPCTable tableRPC;