LayerTwo-Labs / bip300301_enforcer

CUSF software enforcing BIP300 and BIP301 rules.
1 stars 4 forks source link

validator: include original heed error in TryGet #25

Closed torkelrogstad closed 3 weeks ago

torkelrogstad commented 3 weeks ago

This makes the error more scrutable.

Currently when I try GetBlockHeaderInfo I get this:

{
   "code": "unknown",
   "message": "Failed to read from db `block_hash_to_header` at `././bip300301_enforcer/signet.mdb` (key: `200000000000000021755015219a84cb8548aeffe5b067899da7ceac37cd250bedb6a6ee29030000`): error while decoding: io error: unexpected end of file"
}
Ash-L2L commented 3 weeks ago

The source is already available in the error message. You need to format the error in alternative mode to see a backtrace eg. tracing::debug!("{:#}", error)

In general this should always be done when displaying errors, it would be better to find where the error is displayed and fix it there

torkelrogstad commented 3 weeks ago

Closing after discussion in private DMs. No longer applicable