rpc, refactor: Add getblock_prevout

This change eliminates memory usage spike when compiling with Visual
Studio 2022 (at least in Cirrus CI environment).

Easy to review using
`git diff --color-moved-ws=allow-indentation-change --color-moved=dimmed-zebra`
This commit is contained in:
Hennadii Stepanov 2022-06-30 17:46:08 +02:00
parent 5abbc9afec
commit 01d95a3964
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -598,6 +598,29 @@ static CBlockUndo GetUndoChecked(BlockManager& blockman, const CBlockIndex* pblo
return blockUndo; return blockUndo;
} }
const RPCResult getblock_vin{
RPCResult::Type::ARR, "vin", "",
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::ELISION, "", "The same output as verbosity = 2"},
{RPCResult::Type::OBJ, "prevout", "(Only if undo information is available)",
{
{RPCResult::Type::BOOL, "generated", "Coinbase or not"},
{RPCResult::Type::NUM, "height", "The height of the prevout"},
{RPCResult::Type::NUM, "value", "The value in " + CURRENCY_UNIT},
{RPCResult::Type::OBJ, "scriptPubKey", "",
{
{RPCResult::Type::STR, "asm", "The asm"},
{RPCResult::Type::STR, "hex", "The hex"},
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
}},
}},
}},
}
};
static RPCHelpMan getblock() static RPCHelpMan getblock()
{ {
return RPCHelpMan{"getblock", return RPCHelpMan{"getblock",
@ -657,26 +680,7 @@ static RPCHelpMan getblock()
{ {
{RPCResult::Type::OBJ, "", "", {RPCResult::Type::OBJ, "", "",
{ {
{RPCResult::Type::ARR, "vin", "", getblock_vin,
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::ELISION, "", "The same output as verbosity = 2"},
{RPCResult::Type::OBJ, "prevout", "(Only if undo information is available)",
{
{RPCResult::Type::BOOL, "generated", "Coinbase or not"},
{RPCResult::Type::NUM, "height", "The height of the prevout"},
{RPCResult::Type::NUM, "value", "The value in " + CURRENCY_UNIT},
{RPCResult::Type::OBJ, "scriptPubKey", "",
{
{RPCResult::Type::STR, "asm", "The asm"},
{RPCResult::Type::STR, "hex", "The hex"},
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
{RPCResult::Type::STR, "type", "The type (one of: " + GetAllOutputTypes() + ")"},
}},
}},
}},
}},
}}, }},
}}, }},
}}, }},