Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1RgO6w-00020E-T1 for bitcoin-development@lists.sourceforge.net; Thu, 29 Dec 2011 22:06:06 +0000 X-ACL-Warn: Received: from backup-server.nordu.net ([193.10.252.66]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1RgO6v-0007MC-E3 for bitcoin-development@lists.sourceforge.net; Thu, 29 Dec 2011 22:06:06 +0000 Received: from [192.168.0.25] (2508ds5-oebr.0.fullrate.dk [95.166.54.87]) (authenticated bits=0) by backup-server.nordu.net (8.14.3/8.14.3) with ESMTP id pBTM5tRs008552 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 29 Dec 2011 23:05:58 +0100 (CET) From: =?iso-8859-1?Q?Michael_Gr=F8nager?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Thu, 29 Dec 2011 23:05:55 +0100 Message-Id: To: Bitcoin Dev Mime-Version: 1.0 (Apple Message framework v1251.1) X-Mailer: Apple Mail (2.1251.1) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1RgO6v-0007MC-E3 Subject: [Bitcoin-development] Trickle in CNode::SendMessages X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2011 22:06:07 -0000 In CNode::SendMessages there is a trickle algorithm. Judging from the = comments it is supposed to: * at each update round a new (random) trickle node is chosen, with 120 = nodes and an average round time of 100ms (the sleep) we will have moved = through roughly all nodes every 12-15 seconds. * when a node is the trickle node it will get to send all its pending = addresses to its corresponding peer. * when a node is not trickle node (the rest of the nodes) we send = transaction-invs, however, only 1/4 of them - the rest is pushed to wait = for the next round and would eventually get sent. However, the way the 1/4 of the invs are chosen is by:=20 (inv.getHash() ^ hashSalt) & 3 =3D=3D 0 As hashSalt is a constant (static, generated on start up) and as the = hash of an inv is constant for the inv too, the other 3/4 will never get = sent and hence it does not make sense to carry them around from round to = round: if (fTrickleWait) vInvWait.push_back(inv);=20 and: pto->vInventoryToSend =3D vInvWait; The hashSalt will be different for each node in the peer-to-peer network = and hence as long as we have much more than 4 nodes all tx'es will be = sent around. Ironically, this (wrong?) implementation divides the inv forwarding hash = space into 4, along the same lines as we discussed last week for DHTs... I suggest to either keep the algorithm as is, but remove the redundant = vInvWait stuff, or to change the algorithm to e.g. push the tx'es into a = multimap (invHash^hashSalt, invHash) and choose the first 25% in each = round.=20 The last alternative is that I have misunderstood the code... - if so = please correct me ;) Happy New Year! Michael