lbry.go/address/decode.go

20 lines
411 B
Go
Raw Normal View History

2017-09-12 18:02:30 +02:00
package address
import (
"./base58"
"errors"
2017-09-12 18:02:30 +02:00
)
func DecodeAddress(address string, blockchainName string) ([address_length]byte, error) {
2017-09-12 18:02:30 +02:00
decoded, err := base58.DecodeBase58(address, address_length)
if err != nil {
return [address_length]byte{}, errors.New("failed to decode")
}
buf := [address_length]byte{}
for i, b := range decoded {
buf[i] = b
}
return ValidateAddress(buf, blockchainName)
2017-09-12 18:02:30 +02:00
}