dogecoin / dogecoin

very currency
MIT License
14.4k stars 2.8k forks source link

Enhance the log for failures when reading or parsing the fee_estimates.dat file #3501

Open AjaxPop opened 1 month ago

AjaxPop commented 1 month ago

Use a try-catch block for error handling in the TxConfirmStats::Read function.

patricklodder commented 1 month ago

What error didn't get caught?

AjaxPop commented 1 month ago

Although the check on fileDecay ensures the integrity of the data by confirming that it is between 0 (no decay) and 1 (full decay), there remains a potential issue with data corruption or a software bug.

The try-catch block has the benefit of logging any potential errors.

georgeartem commented 1 month ago

Neat. Seems like it would cut out uncertainties.Sent from my iPhoneOn Mar 28, 2024, at 10:27 PM, Skylar Loomis @.***> wrote: Although the check on fileDecay ensures the integrity of the data by confirming that it is between 0 (no decay) and 1 (full decay), there remains a potential issue with data corruption, modification, or a software bug. The try-catch block ensures that the data integrity adheres to specific expectations regarding its values and structure. Additionally, it has the added benefit of logging out any potential errors.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

patricklodder commented 1 month ago

Okay. An overall try-catch already is implemented in the calling code:

https://github.com/dogecoin/dogecoin/blob/6c0095bed1845680b0eee8be53210022773b014c/src/txmempool.cpp#L926

If you're looking to enrich the logged message (I'd support that), it should be done in that catch block instead.