mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
scripted-diff: rename block and undo functions for consistency
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
-BEGIN VERIFY SCRIPT-
grep -r -wE 'WriteBlock|ReadRawBlock|ReadBlock|WriteBlockUndo|ReadBlockUndo' $(git ls-files src/ ':!src/leveldb') && \
echo "Error: One or more target names already exist!" && exit 1
sed -i \
-e 's/\bSaveBlockToDisk/WriteBlock/g' \
-e 's/\bReadRawBlockFromDisk/ReadRawBlock/g' \
-e 's/\bReadBlockFromDisk/ReadBlock/g' \
-e 's/\bWriteUndoDataForBlock/WriteBlockUndo/g' \
-e 's/\bUndoReadFromDisk/ReadBlockUndo/g' \
$(git ls-files src/ ':!src/leveldb')
-END VERIFY SCRIPT-
This commit is contained in:
parent
baaa3b2846
commit
223081ece6
18 changed files with 73 additions and 73 deletions
|
|
@ -196,7 +196,7 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn
|
|||
CBlockUndo blockUndo;
|
||||
const bool is_not_pruned{WITH_LOCK(::cs_main, return !blockman.IsBlockPruned(blockindex))};
|
||||
bool have_undo{is_not_pruned && WITH_LOCK(::cs_main, return blockindex.nStatus & BLOCK_HAVE_UNDO)};
|
||||
if (have_undo && !blockman.UndoReadFromDisk(blockUndo, blockindex)) {
|
||||
if (have_undo && !blockman.ReadBlockUndo(blockUndo, blockindex)) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Undo data expected but can't be read. This could be due to disk corruption or a conflict with a pruning event.");
|
||||
}
|
||||
for (size_t i = 0; i < block.vtx.size(); ++i) {
|
||||
|
|
@ -624,7 +624,7 @@ static CBlock GetBlockChecked(BlockManager& blockman, const CBlockIndex& blockin
|
|||
CheckBlockDataAvailability(blockman, blockindex, /*check_for_undo=*/false);
|
||||
}
|
||||
|
||||
if (!blockman.ReadBlockFromDisk(block, blockindex)) {
|
||||
if (!blockman.ReadBlock(block, blockindex)) {
|
||||
// Block not found on disk. This shouldn't normally happen unless the block was
|
||||
// pruned right after we released the lock above.
|
||||
throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk");
|
||||
|
|
@ -643,7 +643,7 @@ static std::vector<uint8_t> GetRawBlockChecked(BlockManager& blockman, const CBl
|
|||
pos = blockindex.GetBlockPos();
|
||||
}
|
||||
|
||||
if (!blockman.ReadRawBlockFromDisk(data, pos)) {
|
||||
if (!blockman.ReadRawBlock(data, pos)) {
|
||||
// Block not found on disk. This shouldn't normally happen unless the block was
|
||||
// pruned right after we released the lock above.
|
||||
throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk");
|
||||
|
|
@ -664,7 +664,7 @@ static CBlockUndo GetUndoChecked(BlockManager& blockman, const CBlockIndex& bloc
|
|||
CheckBlockDataAvailability(blockman, blockindex, /*check_for_undo=*/true);
|
||||
}
|
||||
|
||||
if (!blockman.UndoReadFromDisk(blockUndo, blockindex)) {
|
||||
if (!blockman.ReadBlockUndo(blockUndo, blockindex)) {
|
||||
throw JSONRPCError(RPC_MISC_ERROR, "Can't read undo data from disk");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue