Definitely not a dumb question, this change results in an extra copy (only a move is happening on this line, but there is a copy inside the getBlock()
function, but a copy is also removed later on due to adding std::move in GenerateBlock
, so the net number of copies should be the same.
I don’t understand this comment. This line is part of the getblocktemplate
RPC, which is a real RPC (possibly used in production). Whereas the GenerateBlock
function is a test-only function for the test-only RPCs generate*
.
So it looks like this is adding an extra copy in production code so that a copy can be removed in test-only code.
Generally, production code should not be adjusted to accommodate tests, but rather the other way round. So doing the inverse here would have been better.
Am I missing something obvious?
Edit: I guess the block is later (unconditionally) serialized as UniValue, so adding or removing a copy here shouldn’t change the overall performance.