Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give more descriptive error for non-WSH(OP_TRUE) block generation #732

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
}
}

// Fill out block witness if dynamic federation is enabled
// since we are assuming WSH(OP_TRUE)
if (!pblock->m_dynafed_params.IsNull()) {
CScript op_true(OP_TRUE);
// Handle OP_TRUE m_signblockscript case
CScript op_true(OP_TRUE);
if (pblock->m_dynafed_params.m_current.m_signblockscript ==
GetScriptForDestination(WitnessV0ScriptHash(op_true))) {
pblock->m_signblock_witness.stack.push_back(std::vector<unsigned char>(op_true.begin(), op_true.end()));
} else if (!pblock->m_dynafed_params.IsNull()) {
throw JSONRPCError(RPC_MISC_ERROR, "Unable to fill out dynamic federation signblockscript witness, are you sure it's WSH(OP_TRUE)?");
}

std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
Expand Down