sanity checks

This commit is contained in:
wowario 2021-06-16 22:43:02 +03:00
parent 72f33077ba
commit 408fe4ec28
No known key found for this signature in database
GPG key ID: 24DCBE762DE9C111

View file

@ -1386,6 +1386,17 @@ bool Blockchain::prevalidate_miner_transaction(const block& b, uint64_t height,
// Miner Block Header Signing // Miner Block Header Signing
if (hf_version >= BLOCK_HEADER_MINER_SIG) if (hf_version >= BLOCK_HEADER_MINER_SIG)
{ {
// sanity checks
if (b.miner_tx.vout.size() != 1)
{
MWARNING("Only 1 output in miner transaction allowed");
return false;
}
if (b.miner_tx.vout[0].target.type() != typeid(txout_to_key))
{
MWARNING("Wrong txout type");
return false;
}
// keccak hash block header data and check miner signature // keccak hash block header data and check miner signature
// if signature is invalid, reject block // if signature is invalid, reject block
crypto::hash sig_data = get_sig_data(b); crypto::hash sig_data = get_sig_data(b);