summaryrefslogtreecommitdiff
path: root/61/be5dda0ce8c8410da44d475f71c91d512a03b4
blob: 5bfe8fa06f465826f308c5dfa5f6ef3a9a8ed4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 <gronager@ceptacle.com>) 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 <bitcoin-development@lists.sourceforge.net>;
	Thu, 29 Dec 2011 23:05:58 +0100 (CET)
From: =?iso-8859-1?Q?Michael_Gr=F8nager?= <gronager@ceptacle.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Date: Thu, 29 Dec 2011 23:05:55 +0100
Message-Id: <AB205206-AC96-4A95-B100-E8F4461B08C5@ceptacle.com>
To: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
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: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=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