From jasper at hashplex.com Wed Aug 12 16:48:20 2015 From: jasper at hashplex.com (Jasper Hugunin) Date: Wed, 12 Aug 2015 09:48:20 -0700 Subject: [Lightning-dev] Python LightningNetwork implementation In-Reply-To: References: <20150811175827.GB8380@lightning.network> Message-ID: The routing protocol is a variant of distance-vector routing . The idea is that nodes tell their peers beforehand "I know how to get to node X, and it will cost you this much." Nodes use this information to build a routing table saying "If I want to send payment to node X, I should forward payment to node B." Then when payment needs to be sent, the node looks up "Which of my peers do I forward to?" That is done by the "SELECT nexthop, cost FROM ROUTES WHERE address = ?" query. If the peer you select does not know the destination, they lied to you. If you have more than one peer, you choose the cheapest one. That said, the current routing protocol is something of a hack to demonstrate potential, rather than a final solution. Thanks, - Jasper On Wed, Aug 12, 2015 at 9:31 AM, Bryan Bishop wrote: > On Wed, Aug 12, 2015 at 11:12 AM, Jasper Hugunin > wrote: > >> Here is the repo: https://github.com/hashplex/Lightning >> > > The routing seems to only send to one peer. What happens if that peer does > not know the destination either? or what if you have more than one peer? > > > https://github.com/hashplex/Lightning/blob/fa94a05170faa954d3f6505265d34ac97983f083/lightning.py#L99 > > - Bryan > http://heybryan.org/ > 1 512 203 0507 > -------------- next part -------------- An HTML attachment was scrubbed... URL: