Merge pull request #620 from rnicoll/1.8-dev-rpc
Disable AuxPoW RPC commands until switchover block
This commit is contained in:
commit
c0737a900b
|
@ -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
|
// 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);
|
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
|
// Context-independent validity checks
|
||||||
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, int nHeight, bool fCheckPOW = true);
|
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);
|
bool CheckBlock(const CBlock& block, CValidationState& state, int nHeight, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
||||||
|
|
|
@ -657,10 +657,15 @@ Value getworkaux(const Array& params, bool fHelp)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (vNodes.empty())
|
if (vNodes.empty())
|
||||||
throw JSONRPCError(-9, "Dogecoin is not connected!");
|
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Dogecoin is not connected!");
|
||||||
|
|
||||||
if (IsInitialBlockDownload())
|
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 map<uint256, pair<CBlock*, unsigned int> > mapNewBlock;
|
||||||
static vector<CBlockTemplate*> vNewBlockTemplate;
|
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.");
|
"the aux proof of work and returns true if it was successful.");
|
||||||
|
|
||||||
if (vNodes.empty())
|
if (vNodes.empty())
|
||||||
throw JSONRPCError(-9, "Dogecoin is not connected!");
|
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Dogecoin is not connected!");
|
||||||
|
|
||||||
if (IsInitialBlockDownload())
|
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 map<uint256, CBlock*> mapNewBlock;
|
||||||
static vector<CBlockTemplate*> vNewBlockTemplate;
|
static vector<CBlockTemplate*> vNewBlockTemplate;
|
||||||
|
|
Loading…
Reference in a new issue