mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-04 04:04:00 +00:00
The HexBytes wrapper type handles decoding byte strings from JSON. In the RPC API, hashes are encoded as hex digits rather than the standard base64. Simplify the implementation of this wrapper using the TextMarshaler interface, which the encoding/json package uses for values (like these) that are meant to be wrapped in JSON strings. In addition, allow HexBytes values to be decoded from either hex OR base64 input. This preserves all existing use, but will allow us to remove some reflection special cases in the RPC decoder plumbing. Update tests to correctly tolerate empty/nil.