Skip to content

Conversation

jimpo
Copy link

@jimpo jimpo commented Jan 23, 2018

Various things to update implementation to match latest revision of BIP 158.

return gcs.BuildGCSFilter(b.p, b.key, b.data)
dataSlice := make([][]byte, 0, len(b.data))
for encoded := range b.data {
item, err := base64.StdEncoding.DecodeString(encoded)
Copy link
Owner

Choose a reason for hiding this comment

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

I think we can actually just do string(encoded) here. We don't need the encoding outside this function at all (doesn't need to be human readable), and IIRC there're fast paths in the compiler for things like map[string(kek)] = 9.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

gcs/gcs.go Outdated
@@ -98,7 +102,7 @@ func BuildGCSFilter(P uint8, key [KeySize]byte, data [][]byte) (*Filter, error)
if len(data) == 0 {
return nil, ErrNoData
}
if len(data) > math.MaxInt32 {
if len(data) > math.MaxUint32 {
Copy link
Owner

Choose a reason for hiding this comment

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

IIRC we changed this as we had issues on 32-bit arm. I'll check to see if this compiles properly on my pi.

Copy link
Author

@jimpo jimpo Feb 1, 2018

Choose a reason for hiding this comment

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

You might be right -- I'll rewrite this line to be safe.


// Count the 1s until we reach a 0.
c, err := b.ReadBit()
if err != nil {
return 0, err
}
for c {
v++
quotient++
Copy link
Owner

Choose a reason for hiding this comment

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

👍

Copy link
Owner

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Won't merge this quite yet until I update neutrino to support the new p2p modifications. As otherwise, people will fetch my fork and find that it doesn't actually work with their node...

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.

2 participants