Merge pull request #620 from rnicoll/1.8-dev-rpc

Disable AuxPoW RPC commands until switchover block
This commit is contained in:
langerhans 2014-08-18 21:17:00 +02:00
commit c0737a900b
2 changed files with 17 additions and 4 deletions

View file

@ -632,6 +632,9 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
// Add this block to the block index, and if necessary, switch the active block chain to this
bool AddToBlockIndex(CBlock& block, CValidationState& state, const CDiskBlockPos& pos);
// Get the block at which AuxPoW is enabled for this network
int GetAuxPowStartBlock();
// Context-independent validity checks
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, int nHeight, bool fCheckPOW = true);
bool CheckBlock(const CBlock& block, CValidationState& state, int nHeight, bool fCheckPOW = true, bool fCheckMerkleRoot = true);

View file

@ -657,10 +657,15 @@ Value getworkaux(const Array& params, bool fHelp)
);
if (vNodes.empty())
throw JSONRPCError(-9, "Dogecoin is not connected!");
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Dogecoin is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(-10, "Dogecoin is downloading blocks...");
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dogecoin is downloading blocks...");
// We use height plus one because we're testing the next block
if ((chainActive.Tip()->nHeight+1) < GetAuxPowStartBlock()) {
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "getworkaux method is not available until switch-over block.");
}
static map<uint256, pair<CBlock*, unsigned int> > mapNewBlock;
static vector<CBlockTemplate*> vNewBlockTemplate;
@ -818,10 +823,15 @@ Value getauxblock(const Array& params, bool fHelp)
"the aux proof of work and returns true if it was successful.");
if (vNodes.empty())
throw JSONRPCError(-9, "Dogecoin is not connected!");
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Dogecoin is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(-10, "Dogecoin is downloading blocks...");
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dogecoin is downloading blocks...");
// We use height plus one because we're testing the next block
if ((chainActive.Tip()->nHeight+1) < GetAuxPowStartBlock()) {
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "getauxblock method is not available until switch-over block.");
}
static map<uint256, CBlock*> mapNewBlock;
static vector<CBlockTemplate*> vNewBlockTemplate;