Move ParseConfirmTarget from rpc/mining to rpc/util

Util is a better home since it's called both by wallet and mining code.

Suggested https://github.com/bitcoin/bitcoin/pull/15288#discussion_r254449444
This commit is contained in:
Russell Yanofsky
2019-02-08 15:29:45 -05:00
parent 2945492424
commit 50e647210d
4 changed files with 15 additions and 13 deletions

View File

@@ -31,16 +31,6 @@
#include <memory>
#include <stdint.h>
unsigned int ParseConfirmTarget(const UniValue& value)
{
int target = value.get_int();
unsigned int max_target = ::feeEstimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
if (target < 1 || (unsigned int)target > max_target) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid conf_target, must be between %u - %u", 1, max_target));
}
return (unsigned int)target;
}
/**
* Return average network hashes per second based on the last 'lookup' blocks,
* or from the last difficulty change if 'lookup' is nonpositive.