From mats at blockchain.com Mon Mar 21 09:42:35 2016 From: mats at blockchain.com (Mats Jerratsch) Date: Mon, 21 Mar 2016 09:42:35 +0000 Subject: [Lightning-dev] Probing final receiver with refund timeout In-Reply-To: <87ziu0mu4t.fsf@rustcorp.com.au> References: <56D6CEA3.3020902@blockchain.com> <8737s5mfy3.fsf@rustcorp.com.au> <56DEF175.20603@blockchain.com> <87wppclcg8.fsf@rustcorp.com.au> <56DFF1A3.5030008@blockchain.com> <87ziu0mu4t.fsf@rustcorp.com.au> Message-ID: <1220B520-7A6E-4BCC-9ED1-0BFCBC07B293@blockchain.com> > OK, let me get the proposal straight: > > 1. Each node will publish its MIN_TIMEOUT (along > with its other info as per Option 2 in > http://lists.linuxfoundation.org/pipermail/lightning-dev/2015-October/000262.html ) > > 2. The payer sums the MIN_TIMEOUT to the payee, adds some random value > (keeping it under the max value allowed by protocol) to give the > initial HTLC timeout. > > 3. The payer puts the 'expected_timeout' in each layer of the onion, by > subtracting the last hops' MIN_TIMEOUT from the initial timeout. > > eg. Say maximum allowed timeout is 20 * 12 hours, and route is: > > A (12 hours) -> B (6 hours) -> C (6 hours) -> D (4 hours) > > Initial timeout has to be at least 12 + 6 + 6 + 4 == 28 hours, plus > some padding for transmission delays, say 29 hours. I take a multiply of the MIN_TIMEOUT, a factor around 2, but yes, that sounds about right > > It picks a random timeout between 29 and 240 hours, say now+100 hours, > and onion looks like: > > [ A: now+100 [ B: now+88 [ C: now+82 [ D: now+76 ] ] ] ] I would not use the MIN_TIMEOUT here, but use it as the minimum time I deduct each hop and add some randomness into it. It also means that you need two values in the onion object: (1) the value you expect to receive (2) the value you should use for the next hop (and therefore the (1) value of the next hop)) So somewhere along this: [ A: now+100;now+80 [ B: now+80;now+65 [ C: now+65;now+54 [ D: now+54;now+40 ] ] ] ] which can obviously be saved in a less redundant way Cheers Mats -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: