@@ -119,7 +119,7 @@ bool BlockFilterIndex::CustomInit(const std::optional<interfaces::BlockKey>& blo
119119 // indicate database corruption or a disk failure, and starting the index would cause
120120 // further corruption.
121121 if (m_db->Exists (DB_FILTER_POS)) {
122- error (" %s: Cannot read current %s state; index may be corrupted" ,
122+ LogError (" %s: Cannot read current %s state; index may be corrupted\n " ,
123123 __func__, GetName ());
124124 return false ;
125125 }
@@ -138,11 +138,11 @@ bool BlockFilterIndex::CustomCommit(CDBBatch& batch)
138138 // Flush current filter file to disk.
139139 AutoFile file{m_filter_fileseq->Open (pos)};
140140 if (file.IsNull ()) {
141- error (" %s: Failed to open filter file %d" , __func__, pos.nFile );
141+ LogError (" %s: Failed to open filter file %d\n " , __func__, pos.nFile );
142142 return false ;
143143 }
144144 if (!FileCommit (file.Get ())) {
145- error (" %s: Failed to commit filter file %d" , __func__, pos.nFile );
145+ LogError (" %s: Failed to commit filter file %d\n " , __func__, pos.nFile );
146146 return false ;
147147 }
148148
@@ -163,13 +163,13 @@ bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, const uint256&
163163 try {
164164 filein >> block_hash >> encoded_filter;
165165 if (Hash (encoded_filter) != hash) {
166- error (" Checksum mismatch in filter decode." );
166+ LogError (" Checksum mismatch in filter decode.\n " );
167167 return false ;
168168 }
169169 filter = BlockFilter (GetFilterType (), block_hash, std::move (encoded_filter), /* skip_decode_check=*/ true );
170170 }
171171 catch (const std::exception& e) {
172- error (" %s: Failed to deserialize block filter from disk: %s" , __func__, e.what ());
172+ LogError (" %s: Failed to deserialize block filter from disk: %s\n " , __func__, e.what ());
173173 return false ;
174174 }
175175
@@ -242,7 +242,7 @@ bool BlockFilterIndex::CustomAppend(const interfaces::BlockInfo& block)
242242
243243 uint256 expected_block_hash = *Assert (block.prev_hash );
244244 if (read_out.first != expected_block_hash) {
245- error (" %s: previous block header belongs to unexpected block %s; expected %s" ,
245+ LogError (" %s: previous block header belongs to unexpected block %s; expected %s\n " ,
246246 __func__, read_out.first .ToString (), expected_block_hash.ToString ());
247247 return false ;
248248 }
@@ -278,14 +278,14 @@ bool BlockFilterIndex::CustomAppend(const interfaces::BlockInfo& block)
278278
279279 for (int height = start_height; height <= stop_height; ++height) {
280280 if (!db_it.GetKey (key) || key.height != height) {
281- error (" %s: unexpected key in %s: expected (%c, %d)" ,
281+ LogError (" %s: unexpected key in %s: expected (%c, %d)\n " ,
282282 __func__, index_name, DB_BLOCK_HEIGHT, height);
283283 return false ;
284284 }
285285
286286 std::pair<uint256, DBVal> value;
287287 if (!db_it.GetValue (value)) {
288- error (" %s: unable to read value in %s at key (%c, %d)" ,
288+ LogError (" %s: unable to read value in %s at key (%c, %d)\n " ,
289289 __func__, index_name, DB_BLOCK_HEIGHT, height);
290290 return false ;
291291 }
@@ -340,11 +340,11 @@ static bool LookupRange(CDBWrapper& db, const std::string& index_name, int start
340340 const CBlockIndex* stop_index, std::vector<DBVal>& results)
341341{
342342 if (start_height < 0 ) {
343- error (" %s: start height (%d) is negative" , __func__, start_height);
343+ LogError (" %s: start height (%d) is negative\n " , __func__, start_height);
344344 return false ;
345345 }
346346 if (start_height > stop_index->nHeight ) {
347- error (" %s: start height (%d) is greater than stop height (%d)" ,
347+ LogError (" %s: start height (%d) is greater than stop height (%d)\n " ,
348348 __func__, start_height, stop_index->nHeight );
349349 return false ;
350350 }
@@ -362,7 +362,7 @@ static bool LookupRange(CDBWrapper& db, const std::string& index_name, int start
362362
363363 size_t i = static_cast <size_t >(height - start_height);
364364 if (!db_it->GetValue (values[i])) {
365- error (" %s: unable to read value in %s at key (%c, %d)" ,
365+ LogError (" %s: unable to read value in %s at key (%c, %d)\n " ,
366366 __func__, index_name, DB_BLOCK_HEIGHT, height);
367367 return false ;
368368 }
@@ -386,7 +386,7 @@ static bool LookupRange(CDBWrapper& db, const std::string& index_name, int start
386386 }
387387
388388 if (!db.Read (DBHashKey (block_hash), results[i])) {
389- error (" %s: unable to read value in %s at key (%c, %s)" ,
389+ LogError (" %s: unable to read value in %s at key (%c, %s)\n " ,
390390 __func__, index_name, DB_BLOCK_HASH, block_hash.ToString ());
391391 return false ;
392392 }
0 commit comments