breez / breez-sdk-greenlight

MIT License
244 stars 43 forks source link

greenlight: wait for channel reestablished #1093

Closed JssDWt closed 1 month ago

JssDWt commented 1 month ago

The calls to send_pay are not covered by greenlight's awaitable channel futures. Therefore wait for channels to be reestablished before doing any calls to send_pay.

Alternative to https://github.com/Blockstream/greenlight/issues/522

JssDWt commented 1 month ago

Capitalized error strings and use ok_or rather than a verbose match statement.

roeierez commented 1 month ago

@JssDWt I talked to Christian today and:

  1. You are right the mechanism is not there.
  2. The get_route that we execute before doesn't care about channel activeness so your analysis is correct.

The one thing he noted is that peer_connected is not enough for channel re-establishment but we need to check the channel state. I believe this is the check in greenlight: https://github.com/Blockstream/greenlight/blob/main/libs/gl-plugin/src/awaitables.rs#L177 @cdecker can you verify that?

JssDWt commented 1 month ago

The one thing he noted is that peer_connected is not enough for channel re-establishment but we need to check the channel state. I believe this is the check in greenlight: https://github.com/Blockstream/greenlight/blob/main/libs/gl-plugin/src/awaitables.rs#L177

I included that check in this PR: https://github.com/breez/breez-sdk-greenlight/pull/1093/files#diff-7466a53546c6cded460ef5502a9168b13cc930d94fdf7d0ea8166bb10c75fe7eR741

roeierez commented 1 month ago

The one thing he noted is that peer_connected is not enough for channel re-establishment but we need to check the channel state. I believe this is the check in greenlight: https://github.com/Blockstream/greenlight/blob/main/libs/gl-plugin/src/awaitables.rs#L177

I included that check in this PR: https://github.com/breez/breez-sdk-greenlight/pull/1093/files#diff-7466a53546c6cded460ef5502a9168b13cc930d94fdf7d0ea8166bb10c75fe7eR741

Oh perfect. How did I miss that?