Skip to content
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

Merged
merged 7 commits into from Oct 12, 2018
Merged

add addresstobase58,base58toaddress API support #658

merged 7 commits into from Oct 12, 2018

Conversation

tanZiWen
Copy link
Collaborator

No description provided.

@@ -118,3 +105,24 @@ func AddressFromBase58(encoded string) (Address, error) {

return ph, nil
}

func VerifyBase58(encoded string) ([]byte, error) {
Copy link
Contributor

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.

Copy link
Collaborator Author

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'

}

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 {
Copy link
Contributor

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

@tanZiWen tanZiWen closed this Sep 27, 2018
@tanZiWen tanZiWen reopened this Sep 27, 2018
@tanZiWen tanZiWen changed the title add addresstobase58,base58toaddress,verifybase58 API support add addresstobase58,base58toaddress API support Sep 27, 2018
Time: uint32(time.Now().Unix()),
Height: this.GetCurrentBlockHeight() + 1,
Tx: tx,
Time: header.Timestamp,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why revert this back?

laizy
laizy previously approved these changes Oct 11, 2018
@laizy laizy merged commit 8135494 into ontio:master Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants