From ZmnSCPxj at protonmail.com Wed Nov 21 02:54:28 2018 From: ZmnSCPxj at protonmail.com (ZmnSCPxj) Date: Wed, 21 Nov 2018 02:54:28 +0000 Subject: [Lightning-dev] Base AMP In-Reply-To: <87va4rp91k.fsf@rustcorp.com.au> References: <RIltvk7eDURKE0wl7VdQs7Y1Rx_DoccGaxe1q5NgwWouzqzbwkX2jXx3rVDSgtSL33ZF2VFmO_bntGSrHUOtFSl7ta3-PTDAHgHQeyeSVEw=@protonmail.com> <87a7maf7jh.fsf@gmail.com> <2GH68_8IDCnzwQUhLoqLVrLZSXXP5jZYM5GLwEsV0CMVL_qvZQpliKI1ng0dmCPA-dlWnFRUuWJV7OQMsoFd-kwDzCGmk27H4dqYV1RPJhc=@protonmail.com> <20181116154527.25adgchhfsz7aa43@erisian.com.au> <CAJ5H3Z5auMCeGaBFj-abuk4n8wk+fX9KQ0k6Q+NyLBadLRy+KA@mail.gmail.com> <87va4rp91k.fsf@rustcorp.com.au> Message-ID: <ABwAufGnHun1G9pmuhqZvty1JaNgzrXdd_G096y3ojBtsMFbCRtUvgtPspZjNAzB6gLiJQRQAInXIrSan_RZUrTX9NK3VyXkxdkBvrwzG9M=@protonmail.com> Good morning Rusty, > And do not play with `amount_to_forward`, as it's an important > signal to the final node that the previous node did not offer less value > for the HTLC than it was supposed to. (You could steal the top bit to > signal partial payment if you really want to). I do not view this as playing with the existing `amt_to_forward`, but rather retaining its previous use. If it helps, we can rewrite the *current* pre-AMP spec as below: 2. data: ... * [`8` : `amt_to_forward` / `amt_to_pay`] ... * `amt_to_forward` - for **non-final** nodes, this is the value to forward to the next node. Non-final nodes MUST check: incoming_htlc_amt - fee >= amt_to_forward * `amt_to_pay` - for **final** nodes, this is the value that is intended to reach it. Final nodes MUST check: incoming_htlc_amt >= amt_to_pay Then for Base AMP: * `amt_to_pay` - for **final** nodes, this is the total value that is intended to reach it. If `incomplete_payment` flag is not set, final nodes MUST check: incoming_htlc_amt >= amt_to_pay If `incomplete_payment` flag is set, then final nodes must claim HTLCs only if: sum(incoming_htlc_amt) >= amt_to_pay Where `sum(incoming_htlc_amt)` is the total `incoming_htlc_amt` for all incoming HTLCs terminating at this final node with the same `payment_hash`. Now perhaps we can argue that for AMP we should have two fields `amt_to_pay_for_this_partial_payment` and `amt_to_pay_for_total_payment` instead. Regards, ZmnSCPxj