Title: bitcoinj bit by bitcoin flood protection Post by: noa on April 09, 2011, 09:11:06 PM I took bitcoinj on a test drive today. Firstly, I would like to say that I'm really happy about the project. I think that having a second independent bitcoin protocol implementation is really valuable, especially since reference implementation code base have a quite steep learning curve.
However, when trying to start up the included PingService it fails to download the initial block chain from the bitcoin peer running on localhost. When i start up the PingService it starts to try to download the blocks from that it has gotten previously. After a few tens of blocks received the peer on localhost:8333 closes the TCP connection, and writes something along the lines of: socket send flood control disconnect (1380543 bytes) in the it's debug.log. I'll look into working around this tomorrow, but thought I should bring this up here first. What would be the reasonable thing for a client to do to not be seen as flooding by the bitcoin peer? The method I'm thinking about is to split the list of block hashes returned as a response to the getblocks message in several chunks and send a few separate getdata requests with a delay timer. cheers noa Version info: bitcoin client 0.3.20.1 BETA, OSX, no special settings bitcoinj r51 Title: Re: bitcoinj bit by bitcoin flood protection Post by: dave.gz2ba on April 10, 2011, 06:35:49 AM Found the same, and agree on splitting up the requests.
Having this complete faster than a single peer's rate-limit is a pretty good reason to support multiple peers and do the load-balancing across peers, then across time if still necessary. I was thinking of doing this anyway, to cut down on an initial time required for block-chain fast-forwarding. Question is, do apps implement the multi-peer management or would bitcoinj consider including this at some point? Title: Re: bitcoinj bit by bitcoin flood protection Post by: Cdecker on April 10, 2011, 12:10:01 PM I opensource BitDroid-Network (http://bitcointalk.org/index.php?topic=3662.0), but once [mike]'s implementation hit there wasn't much interest in it so I stopped developing it. One of the main advantages is that I do in fact allow multiple connections and splitting the requests over multiple connections is a simple matter of implementing an actionlistener. Did I mention it uses non-blocking IO which allows for several hundred connections on a computer or dozens on an android phone?
Title: Re: bitcoinj bit by bitcoin flood protection Post by: Gavin Andresen on April 10, 2011, 04:05:15 PM 0.3.20.1 -maxsendbuffer was too small for the initial block download-- you were probably just unlucky and connected to a 0.3.20.1 node. Connect to somebody running either 0.3.20.2 or an earlier release and you won't run into that problem (does bitcoinj re-connect if disconnected during block download?)
Title: Re: bitcoinj bit by bitcoin flood protection Post by: noa on April 10, 2011, 05:42:01 PM (does bitcoinj re-connect if disconnected during block download?) Oh, if it's just a buggy version of the mainline client that triggers this it's probably not needed to modify bitcoinj to work around it. bitcoinj doesn't re-connect currently. The I/O thread dies and the main thread continues indefinitely waiting for the blockchain to be downloaded. /noa Title: Re: bitcoinj bit by bitcoin flood protection Post by: Mike Hearn on April 10, 2011, 11:06:04 PM Yes, I reported that bug to Gavin. It's not a BitCoinJ problem. Nothing can download the block chain successfully from those nodes. They are basically broke. I wonder if it's worth an alert broadcast actually, but I suspect that functionality is pretty useless given the number of headless nodes there must be out there.
Title: Re: bitcoinj bit by bitcoin flood protection Post by: Cdecker on April 19, 2011, 11:48:38 AM I wonder whether my problem with my own implementation applies here. I seem to get disconnected when asking other peers for their known peers:
Code: 323275 [main] INFO Received /205.185.123.216: null of type OUTGOING_CONNECTION_TYPE Is it the flood protection hitting me or do I have something seriously wrong? Title: Re: bitcoinj bit by bitcoin flood protection Post by: Mike Hearn on April 19, 2011, 05:14:43 PM If it's flood protection you can see a message in the logs stating that it was that.
Title: Re: bitcoinj bit by bitcoin flood protection Post by: Cdecker on April 19, 2011, 08:07:53 PM It's rather strange, when connecting to the local client it all works nicely, it's only when trying to connect to remote clients, which means I cannot check it as easily.
Not asking for the addresses helps and most connections will survive :) Still trying to reproduce the error :D Edit: sorry for hijacking the thread, I'll create a new one if needed ^^ Title: Re: bitcoinj bit by bitcoin flood protection Post by: Mike Hearn on April 19, 2011, 08:50:45 PM You can also just look at the version number of the node. If it's between the versions that had the bug, there's your issue.
|