rpc: rename coinbase_script to coinbase_output_script

This commit is contained in:
Sjors Provoost 2024-11-21 10:41:30 +01:00
parent ff873a20a7
commit 7ab733ede4
No known key found for this signature in database
GPG key ID: 57FF9BDBCC301009

View file

@ -158,11 +158,11 @@ static bool GenerateBlock(ChainstateManager& chainman, Mining& miner, CBlock&& b
return true;
}
static UniValue generateBlocks(ChainstateManager& chainman, Mining& miner, const CScript& coinbase_script, int nGenerate, uint64_t nMaxTries)
static UniValue generateBlocks(ChainstateManager& chainman, Mining& miner, const CScript& coinbase_output_script, int nGenerate, uint64_t nMaxTries)
{
UniValue blockHashes(UniValue::VARR);
while (nGenerate > 0 && !chainman.m_interrupt) {
std::unique_ptr<BlockTemplate> block_template(miner.createNewBlock(coinbase_script));
std::unique_ptr<BlockTemplate> block_template(miner.createNewBlock(coinbase_output_script));
CHECK_NONFATAL(block_template);
std::shared_ptr<const CBlock> block_out;
@ -236,9 +236,9 @@ static RPCHelpMan generatetodescriptor()
const auto num_blocks{self.Arg<int>("num_blocks")};
const auto max_tries{self.Arg<uint64_t>("maxtries")};
CScript coinbase_script;
CScript coinbase_output_script;
std::string error;
if (!getScriptFromDescriptor(self.Arg<std::string>("descriptor"), coinbase_script, error)) {
if (!getScriptFromDescriptor(self.Arg<std::string>("descriptor"), coinbase_output_script, error)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, error);
}
@ -246,7 +246,7 @@ static RPCHelpMan generatetodescriptor()
Mining& miner = EnsureMining(node);
ChainstateManager& chainman = EnsureChainman(node);
return generateBlocks(chainman, miner, coinbase_script, num_blocks, max_tries);
return generateBlocks(chainman, miner, coinbase_output_script, num_blocks, max_tries);
},
};
}
@ -292,9 +292,9 @@ static RPCHelpMan generatetoaddress()
Mining& miner = EnsureMining(node);
ChainstateManager& chainman = EnsureChainman(node);
CScript coinbase_script = GetScriptForDestination(destination);
CScript coinbase_output_script = GetScriptForDestination(destination);
return generateBlocks(chainman, miner, coinbase_script, num_blocks, max_tries);
return generateBlocks(chainman, miner, coinbase_output_script, num_blocks, max_tries);
},
};
}
@ -328,16 +328,16 @@ static RPCHelpMan generateblock()
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
const auto address_or_descriptor = request.params[0].get_str();
CScript coinbase_script;
CScript coinbase_output_script;
std::string error;
if (!getScriptFromDescriptor(address_or_descriptor, coinbase_script, error)) {
if (!getScriptFromDescriptor(address_or_descriptor, coinbase_output_script, error)) {
const auto destination = DecodeDestination(address_or_descriptor);
if (!IsValidDestination(destination)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address or descriptor");
}
coinbase_script = GetScriptForDestination(destination);
coinbase_output_script = GetScriptForDestination(destination);
}
NodeContext& node = EnsureAnyNodeContext(request.context);
@ -371,7 +371,7 @@ static RPCHelpMan generateblock()
ChainstateManager& chainman = EnsureChainman(node);
{
std::unique_ptr<BlockTemplate> block_template{miner.createNewBlock(coinbase_script, {.use_mempool = false})};
std::unique_ptr<BlockTemplate> block_template{miner.createNewBlock(coinbase_output_script, {.use_mempool = false})};
CHECK_NONFATAL(block_template);
block = block_template->getBlock();