2
0
mirror of https://github.com/lnbook/lnbook synced 2024-11-15 00:15:05 +00:00

Edited 09_channel_operation.asciidoc with Atlas code editor

This commit is contained in:
kristen@oreilly.com 2021-10-28 07:00:15 -07:00
parent 904346615d
commit 380fe8eab3

View File

@ -264,13 +264,15 @@ It's a really simple message:
+payment_preimage+:: The secret that proves payment was made and redeems the HTLC. This is the +R+ value that was hashed by Dina to produce the payment hash in the invoice to Alice.
When Chan receives this message, he will immediately check if the payment_preimage (let's call it +R+) produces the payment hash (let's call it +H+) in the HTLC that he offered to Dina. He hashes it like this:
When Chan receives this message, he will immediately check if the payment_preimage (let's call it _R_) produces the payment hash (let's call it _H_) in the HTLC that he offered to Dina. He hashes it like this:
----
H = RIPEMD160( SHA-256 (R) )
----
++++
<ul class="simplelist">
<li><em>H</em> = RIPEMD160( SHA-256 (<em>R</em>) )</li>
</ul>
++++
If the result +H+ matches the payment hash in the HTLC, Chan can do a little dance of celebration. This long-awaited secret can be used to redeem the HTLC, and will be passed back along the chain of payment channels all the way to Alice, resolving every HTLC that was part of this payment to Dina.
If the result _H_ matches the payment hash in the HTLC, Chan can do a little dance of celebration. This long-awaited secret can be used to redeem the HTLC, and will be passed back along the chain of payment channels all the way to Alice, resolving every HTLC that was part of this payment to Dina.
Let's go back to Alice and Bob's channel and watch them unwind the HTLC. To get there, let's assume Dina sent the +update_fulfill_htlc+ to Chan, Chan sent +update_fulfill_htlc+ to Bob, and Bob sent +update_fulfill_htlc+ to Alice. The payment preimage has propagated all the way back to Alice.