kaspanet / rusty-kaspa

Kaspa full-node reference implementation and related libraries in the Rust programming language
ISC License
442 stars 144 forks source link

Improve error handling in bech32 decoding #323

Closed biryukovmaxim closed 10 months ago

biryukovmaxim commented 10 months ago

Refactored the bech32 decoding function to improve error handling. Previously, an error occurred if the REV_CHARSET returned a value not within its range, due to direct indexing. This has now been altered to a safer "get" method, which outputs a default value of 100 in case of out-of-range input. This improvement increases the reliability and robustness of the code, effectively reducing the possibility of runtime failures.