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

Hash.Bytes() fix #147

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/prototyp/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,20 @@ func (h Hash) IsValidTxnHash() bool {
return true
}

func (h Hash) Bytes() []byte {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not able to check it right now as I'm on holidays, however this may make indexer and other services using this new version of library not backward compatible.

I wouldn't change that. It's risky.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. I prefer not to make this change.. is it required..?

Copy link
Member

Choose a reason for hiding this comment

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

I propose let’s keep this PR as a draft and we can reconsider it in the future

return h.Hash().Bytes()
func (h Hash) Bytes() ([]byte, error) {
s := h.String()
if len(s) < 2 {
return []byte{}, nil
}
return hex.DecodeString(s[2:])
}

func (h *Hash) Hash() common.Hash {
return common.HexToHash(h.String())
}

func (h Hash) Value() (driver.Value, error) {
s := h.String()
if len(s) < 2 {
return []byte{}, nil
}
return hex.DecodeString(s[2:])
return h.Bytes()
}

func (h *Hash) Scan(src interface{}) error {
Expand Down
Loading