mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-11-19 10:23:55 +01:00
Myriadcoin 0.11 port
This commit is contained in:
+88
-45
@@ -1,13 +1,14 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef _BITCOINRPC_SERVER_H_
|
||||
#define _BITCOINRPC_SERVER_H_ 1
|
||||
#ifndef BITCOIN_RPCSERVER_H
|
||||
#define BITCOIN_RPCSERVER_H
|
||||
|
||||
#include "uint256.h"
|
||||
#include "amount.h"
|
||||
#include "rpcprotocol.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
@@ -18,48 +19,85 @@
|
||||
#include "json/json_spirit_utils.h"
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
|
||||
class CBlockIndex;
|
||||
class CRPCCommand;
|
||||
|
||||
/* Start RPC threads */
|
||||
namespace RPCServer
|
||||
{
|
||||
void OnStarted(boost::function<void ()> slot);
|
||||
void OnStopped(boost::function<void ()> slot);
|
||||
void OnPreCommand(boost::function<void (const CRPCCommand&)> slot);
|
||||
void OnPostCommand(boost::function<void (const CRPCCommand&)> slot);
|
||||
}
|
||||
|
||||
class CBlockIndex;
|
||||
class CNetAddr;
|
||||
|
||||
class AcceptedConnection
|
||||
{
|
||||
public:
|
||||
virtual ~AcceptedConnection() {}
|
||||
|
||||
virtual std::iostream& stream() = 0;
|
||||
virtual std::string peer_address_to_string() const = 0;
|
||||
virtual void close() = 0;
|
||||
};
|
||||
|
||||
/** Start RPC threads */
|
||||
void StartRPCThreads();
|
||||
/* Alternative to StartRPCThreads for the GUI, when no server is
|
||||
/**
|
||||
* Alternative to StartRPCThreads for the GUI, when no server is
|
||||
* used. The RPC thread in this case is only used to handle timeouts.
|
||||
* If real RPC threads have already been started this is a no-op.
|
||||
*/
|
||||
void StartDummyRPCThread();
|
||||
/* Stop RPC threads */
|
||||
/** Stop RPC threads */
|
||||
void StopRPCThreads();
|
||||
/** Query whether RPC is running */
|
||||
bool IsRPCRunning();
|
||||
|
||||
/*
|
||||
Type-check arguments; throws JSONRPCError if wrong type given. Does not check that
|
||||
the right number of arguments are passed, just that any passed are the correct type.
|
||||
Use like: RPCTypeCheck(params, boost::assign::list_of(str_type)(int_type)(obj_type));
|
||||
*/
|
||||
/**
|
||||
* Set the RPC warmup status. When this is done, all RPC calls will error out
|
||||
* immediately with RPC_IN_WARMUP.
|
||||
*/
|
||||
void SetRPCWarmupStatus(const std::string& newStatus);
|
||||
/* Mark warmup as done. RPC calls will be processed from now on. */
|
||||
void SetRPCWarmupFinished();
|
||||
|
||||
/* returns the current warmup state. */
|
||||
bool RPCIsInWarmup(std::string *statusOut);
|
||||
|
||||
/**
|
||||
* Type-check arguments; throws JSONRPCError if wrong type given. Does not check that
|
||||
* the right number of arguments are passed, just that any passed are the correct type.
|
||||
* Use like: RPCTypeCheck(params, boost::assign::list_of(str_type)(int_type)(obj_type));
|
||||
*/
|
||||
void RPCTypeCheck(const json_spirit::Array& params,
|
||||
const std::list<json_spirit::Value_type>& typesExpected, bool fAllowNull=false);
|
||||
/*
|
||||
Check for expected keys/value types in an Object.
|
||||
Use like: RPCTypeCheck(object, boost::assign::map_list_of("name", str_type)("value", int_type));
|
||||
*/
|
||||
/**
|
||||
* Check for expected keys/value types in an Object.
|
||||
* Use like: RPCTypeCheck(object, boost::assign::map_list_of("name", str_type)("value", int_type));
|
||||
*/
|
||||
void RPCTypeCheck(const json_spirit::Object& o,
|
||||
const std::map<std::string, json_spirit::Value_type>& typesExpected, bool fAllowNull=false);
|
||||
|
||||
/*
|
||||
Run func nSeconds from now. Uses boost deadline timers.
|
||||
Overrides previous timer <name> (if any).
|
||||
/**
|
||||
* Run func nSeconds from now. Uses boost deadline timers.
|
||||
* Overrides previous timer <name> (if any).
|
||||
*/
|
||||
void RPCRunLater(const std::string& name, boost::function<void(void)> func, int64_t nSeconds);
|
||||
|
||||
//! Convert boost::asio address to CNetAddr
|
||||
extern CNetAddr BoostAsioToCNetAddr(boost::asio::ip::address address);
|
||||
|
||||
typedef json_spirit::Value(*rpcfn_type)(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
class CRPCCommand
|
||||
{
|
||||
public:
|
||||
std::string category;
|
||||
std::string name;
|
||||
rpcfn_type actor;
|
||||
bool okSafeMode;
|
||||
bool threadSafe;
|
||||
bool reqWallet;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -86,10 +124,10 @@ public:
|
||||
|
||||
extern const CRPCTable tableRPC;
|
||||
|
||||
//
|
||||
// Utilities: convert hex-encoded Values
|
||||
// (throws error if not hex).
|
||||
//
|
||||
/**
|
||||
* Utilities: convert hex-encoded Values
|
||||
* (throws error if not hex).
|
||||
*/
|
||||
extern uint256 ParseHashV(const json_spirit::Value& v, std::string strName);
|
||||
extern uint256 ParseHashO(const json_spirit::Object& o, std::string strKey);
|
||||
extern std::vector<unsigned char> ParseHexV(const json_spirit::Value& v, std::string strName);
|
||||
@@ -99,10 +137,9 @@ extern void InitRPCMining();
|
||||
extern void ShutdownRPCMining();
|
||||
|
||||
extern int64_t nWalletUnlockTime;
|
||||
extern int64_t AmountFromValue(const json_spirit::Value& value);
|
||||
extern json_spirit::Value ValueFromAmount(int64_t amount);
|
||||
extern CAmount AmountFromValue(const json_spirit::Value& value);
|
||||
extern json_spirit::Value ValueFromAmount(const CAmount& amount);
|
||||
extern double GetDifficulty(const CBlockIndex* blockindex, int algo);
|
||||
extern std::string HexBits(unsigned int nBits);
|
||||
extern std::string HelpRequiringPassphrase();
|
||||
extern std::string HelpExampleCli(std::string methodname, std::string args);
|
||||
extern std::string HelpExampleRpc(std::string methodname, std::string args);
|
||||
@@ -118,17 +155,21 @@ extern json_spirit::Value getnettotals(const json_spirit::Array& params, bool fH
|
||||
|
||||
extern json_spirit::Value dumpprivkey(const json_spirit::Array& params, bool fHelp); // in rpcdump.cpp
|
||||
extern json_spirit::Value importprivkey(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value importaddress(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value dumpwallet(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value importwallet(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
extern json_spirit::Value getgenerate(const json_spirit::Array& params, bool fHelp); // in rpcmining.cpp
|
||||
extern json_spirit::Value setgenerate(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value generate(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getnetworkhashps(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value gethashespersec(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getmininginfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getwork(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value prioritisetransaction(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getblocktemplate(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value submitblock(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value estimatefee(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value estimatepriority(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getauxblock(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
extern json_spirit::Value getnewaddress(const json_spirit::Array& params, bool fHelp); // in rpcwallet.cpp
|
||||
extern json_spirit::Value getaccountaddress(const json_spirit::Array& params, bool fHelp);
|
||||
@@ -166,6 +207,8 @@ extern json_spirit::Value getinfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getwalletinfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getblockchaininfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getnetworkinfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value setmocktime(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value resendwallettransactions(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
extern json_spirit::Value getrawtransaction(const json_spirit::Array& params, bool fHelp); // in rcprawtransaction.cpp
|
||||
extern json_spirit::Value listunspent(const json_spirit::Array& params, bool fHelp);
|
||||
@@ -176,29 +219,29 @@ extern json_spirit::Value decoderawtransaction(const json_spirit::Array& params,
|
||||
extern json_spirit::Value decodescript(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value signrawtransaction(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value sendrawtransaction(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value gettxoutproof(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value verifytxoutproof(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
extern json_spirit::Value getblockcount(const json_spirit::Array& params, bool fHelp); // in rpcblockchain.cpp
|
||||
extern json_spirit::Value getbestblockhash(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getdifficulty(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value settxfee(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getmempoolinfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getrawmempool(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getblockhash(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getblock(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value gettxoutsetinfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value gettxout(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value verifychain(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getchaintips(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value invalidateblock(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value reconsiderblock(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
extern json_spirit::Value makekeypair(const json_spirit::Array& params, bool fHelp);
|
||||
// in rest.cpp
|
||||
extern bool HTTPReq_REST(AcceptedConnection *conn,
|
||||
const std::string& strURI,
|
||||
const std::string& strRequest,
|
||||
const std::map<std::string, std::string>& mapHeaders,
|
||||
bool fRun);
|
||||
|
||||
extern json_spirit::Value getnewstealthaddress(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value liststealthaddresses(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value importstealthaddress(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value sendtostealthaddress(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value clearwallettransactions(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value scanforalltxns(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value scanforstealthtxns(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
extern json_spirit::Value getworkaux(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getauxblock(const json_spirit::Array& params, bool fHelp);
|
||||
|
||||
#endif
|
||||
#endif // BITCOIN_RPCSERVER_H
|
||||
|
||||
Reference in New Issue
Block a user