mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Merge bitcoin/bitcoin#28483: refactor: Return CAutoFile from BlockManager::Open*File()
fa56c421beReturn CAutoFile from BlockManager::Open*File() (MarcoFalke)9999b89cd3Make BufferedFile to be a CAutoFile wrapper (MarcoFalke)fa389d902frefactor: Drop unused fclose() from BufferedFile (MarcoFalke) Pull request description: This is required for https://github.com/bitcoin/bitcoin/pull/28052, but makes sense on its own, because offloading logic to `CAutoFile` instead of re-implementing it allows to delete code and complexity. ACKs for top commit: TheCharlatan: Re-ACKfa56c421bewillcl-ark: tACKfa56c421beTree-SHA512: fe4638f3a6bd3f9d968cfb9ae3259c9d6cd278fe2912cbc90289851311c8c781099db4c160e775960975c4739098d9af801a8d2d12603f371f8edfe134d8f85a
This commit is contained in:
@@ -4577,7 +4577,7 @@ bool Chainstate::LoadGenesisBlock()
|
||||
}
|
||||
|
||||
void ChainstateManager::LoadExternalBlockFile(
|
||||
FILE* fileIn,
|
||||
CAutoFile& file_in,
|
||||
FlatFilePos* dbp,
|
||||
std::multimap<uint256, FlatFilePos>* blocks_with_unknown_parent)
|
||||
{
|
||||
@@ -4589,8 +4589,7 @@ void ChainstateManager::LoadExternalBlockFile(
|
||||
|
||||
int nLoaded = 0;
|
||||
try {
|
||||
// This takes over fileIn and calls fclose() on it in the BufferedFile destructor
|
||||
BufferedFile blkdat{fileIn, 2 * MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE + 8, CLIENT_VERSION};
|
||||
BufferedFile blkdat{file_in, 2 * MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE + 8};
|
||||
// nRewind indicates where to resume scanning in case something goes wrong,
|
||||
// such as a block fails to deserialize.
|
||||
uint64_t nRewind = blkdat.GetPos();
|
||||
|
||||
Reference in New Issue
Block a user