base58.CheckDecode handles the version bytes incorrectly
Hi
https://github.com/btcsuite/btcutil/blob/02a4fd9de1d52e877491996349a92d54c653ccbf/base58/base58check.go#L43
CheckDecode shaves off 1 version byte, but there are situations where there are for example 4 version bytes (xpub base58 encoding), or possibly none at all. I currently call this function and glue together the 4 byte version from the first byte returned and the first three bytes of the result, which is not ideal.
Actually, CheckDecode should not worry about the version at all, as that is not part of base58 check encoding. If there are version bytes and how they look like should be decided by the client.
Thoughts on how to fix it? For backwards compatibility, maybe it makes sense to add another function CheckDecodePlain that just decodes and returns the complete result without the first byte treated differently.
Transferred from the old btcutil repo.