Given that Alice wants to pay Bob in the lightning network, Bob first creates an invoice (using the python api) for A as follows:
request = invoicesrpc.AddHoldInvoiceRequest(hash=r_hash, value=30000)
response_hold_B_to_A = stub.AddHoldInvoice(request, metadata=[('macaroon', macaroon)])
and sent the payment request in response_hold_B_to_A to Alice.
Next, Alice sends the payment to Bob as follows:
request = routerrpc.SendPaymentRequest(payment_request="<bob_invoice>", timeout_seconds=10000)
for resp in stub.SendPaymentV2(request, metadata=[('macaroon', macaroon)]): print(resp)
Let say after Alice sends the payment it will go offline, and Bob before the payment time expires releases its preimage of the invoice as follow:
request = invoicesrpc.SettleInvoiceMsg(preimage=r_preimage)
response = stub.SettleInvoice(request, metadata=[('macaroon', macaroon)])
At this point, if Bob checks its channels by executing request = lnrpc.ListChannelsRequest()
then the htlc is gone and the channel is inactive and the channel balance is NOT updated; However, if Bob checks the status of the invoice by executing:
request = invoicesrpc.SubscribeSingleInvoiceRequest(r_hash=r_hash)
for response in stub.SubscribeSingleInvoice(request, metadata=[('macaroon', macaroon)])
it shows that state of the payment is SETTLED.
Now if Bob closes the channel (forcefully) then the balance still not reflected.
In summary Bob's channel balance does not change even though he has done everything right. Can someone please explain what is happening here? and how can Bob get paid in this situation? Should he go on the blockchain with its preimage and if so how would it do it?
commitment_signed
messages were sent and the state was moved forward? before the node went down?stub.SettleInvoice
python api. Tried to look into the code to see what the flow is but kind of got lost. I see that the go code is calling theSettleInvoice
function but cannot find where the implementation of it is. Can you point to the file where SettleInvoice is? I think the channel arbitrator cannot extract the preimage from the DB to settle the payment on Bob's side.