From: "Michael Grønager" <gronager@ceptacle.com>
To: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] Trickle in CNode::SendMessages
Date: Fri, 30 Dec 2011 08:38:22 +0100 [thread overview]
Message-ID: <E986F3D9-1FAF-4BEF-8B16-2BEF3897243D@ceptacle.com> (raw)
In-Reply-To: <AB205206-AC96-4A95-B100-E8F4461B08C5@ceptacle.com>
Small correction - if the node is the trickle node it gets all invs, not just the special quarter. This means that everything get distributed everywhere every 12-15seconds, but a special quarter of the hash space is treated earlier, so there is a meaning for vInvWait, but there is still a mismatch between comments and code.
Cheers,
M
On 29/12/2011, at 23:05, Michael Grønager wrote:
> 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:
> (inv.getHash() ^ hashSalt) & 3 == 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);
> and:
> pto->vInventoryToSend = 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.
>
> The last alternative is that I have misunderstood the code... - if so please correct me ;)
>
> Happy New Year!
>
> Michael
>
>
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
Michael Gronager, PhD
Owner Ceptacle / NDGF Director, NORDUnet A/S
Jens Juels Gade 33
2100 Copenhagen E
Mobile: +45 31 62 14 01
E-mail: gronager@ceptacle.com
prev parent reply other threads:[~2011-12-30 7:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-29 22:05 [Bitcoin-development] Trickle in CNode::SendMessages Michael Grønager
2011-12-30 7:38 ` Michael Grønager [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E986F3D9-1FAF-4BEF-8B16-2BEF3897243D@ceptacle.com \
--to=gronager@ceptacle.com \
--cc=bitcoin-development@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox