Skip to content

Commit b71b5e6

Browse files
committed
qml: lnurlw: bind walletCanReceive to in-liquidity
binds the walletCanReceive variable to the available inbound liquidity so the withdraw button gets enabled when the channels reconnect if the user opens a lnurlw request dialog before the channels have connected.
1 parent 60282c0 commit b71b5e6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

electrum/gui/qml/components/LnurlWithdrawRequestDialog.qml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ ElDialog {
3232
property bool valid: amountValid
3333

3434
Component.onCompleted: {
35-
// Initialize walletCanReceive (instead of binding wallet.lightningCanReceive.satsInt)
36-
// to prevent binding loop if wallet.lightningCanReceive.satsInt changes
37-
walletCanReceive = wallet.lightningCanReceive.satsInt
35+
dialog.walletCanReceive = wallet.lightningCanReceive.satsInt
36+
}
37+
38+
Connections {
39+
// assign walletCanReceive directly to prevent a binding loop
40+
target: wallet
41+
function onLightningCanReceiveChanged() {
42+
if (!requestDetails.busy) {
43+
// don't assign while busy to prevent the view from changing while receiving
44+
// the incoming payment
45+
dialog.walletCanReceive = wallet.lightningCanReceive.satsInt
46+
}
47+
}
3848
}
3949

4050
ColumnLayout {

0 commit comments

Comments
 (0)