New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add addresstobase58,base58toaddress API support #658
Conversation
common/address.go
Outdated
@@ -118,3 +105,24 @@ func AddressFromBase58(encoded string) (Address, error) { | |||
|
|||
return ph, nil | |||
} | |||
|
|||
func VerifyBase58(encoded string) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original AddressFromBase58
has verified this, so any reason you need this function? and this implementation is buggy since the checksum is not verified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, what's the meaning of 'buggy'
common/address.go
Outdated
} | ||
|
||
buf := x.Bytes() | ||
if len(buf) != 1+ADDR_LEN+4 || buf[0] != byte(23) { | ||
return ADDRESS_EMPTY, errors.New("wrong encoded address") | ||
} | ||
|
||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err
has checked at line 95
Time: uint32(time.Now().Unix()), | ||
Height: this.GetCurrentBlockHeight() + 1, | ||
Tx: tx, | ||
Time: header.Timestamp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why revert this back?
No description provided.