Giter Club home page Giter Club logo

bmd's People

Contributors

danielkrawisz avatar jimmysong avatar

Stargazers

 avatar

Watchers

 avatar

bmd's Issues

Bug in addrmgr.updateAddress

In the updateAddress function, say you try to update the same address multiple times. Well in lines 198 - 201 in addrmanager.go there is a condition to return the function without adding the address in a new bucket for a certain probability. If the function does not return at that point, we go down to line 213 where the getNewBucket function is called. Then, in lines 216 to 218, the function returns if the given bucket already has that address in it. However, the problem is that getNewBucket always returns the same number for a given input. Therefore, if you try to add the same address twice, the function always returns without adding the address in a second bucket because getNewBucket always gives it a bucket that already the address in it.

This is clearly a bug because the function would not be written this way if getNewBucket was always expected to return the same number always for any given address. Also, there is a constant called newBucketsPerAddress which is set to four, so clearly it is expected that there could be up to 4 new buckets that could have this address in it. Also, in the Good function, we go through every new bucket to check if a given address is in it, so it seems as if potentially the address might be found in any new bucket. However, there is no way for the new address to get in any bucket but the one whose index is always returned by getNewBucket. This means that there are some lines in updateAddress that cannot be reached by any unit test.

getNewBucket does not have comments explaining what it is supposed to do, so I'm not really sure what the expected behavior is supposed to be or what to do to fix this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.