Skip to content

Commit

Permalink
Merge pull request #2429 from kaloudis/lnd-force-close-fix
Browse files Browse the repository at this point in the history
Close Channel: Force Close: fee rate fix
  • Loading branch information
kaloudis authored Sep 24, 2024
2 parents 47fee65 + 82bbe13 commit 244211e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 44 deletions.
4 changes: 3 additions & 1 deletion backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ export default class EmbeddedLND extends LND {
urlParams && urlParams[1] ? Number(urlParams[1]) : 0;
const force = urlParams && urlParams[2] ? true : false;
const sat_per_vbyte =
urlParams && urlParams[3] ? Number(urlParams[3]) : undefined;
urlParams && urlParams[3] && !urlParams[2]
? Number(urlParams[3])
: undefined;
const delivery_address =
urlParams && urlParams[4] ? urlParams[4] : undefined;

Expand Down
2 changes: 1 addition & 1 deletion backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export default class LND {
urlParams && urlParams[1]
}?force=${urlParams && urlParams[2]}`;

if (urlParams && urlParams[3]) {
if (urlParams && !urlParams[2] && urlParams[3]) {
requestString += `&sat_per_vbyte=${urlParams && urlParams[3]}`;
}

Expand Down
2 changes: 1 addition & 1 deletion backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export default class LightningNodeConnect {
force: urlParams && urlParams[2]
};

if (urlParams && urlParams[3]) {
if (urlParams && urlParams[3] && !urlParams[2]) {
params.sat_per_vbyte = Number(urlParams[3]);
}

Expand Down
86 changes: 45 additions & 41 deletions views/Channels/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -705,25 +705,51 @@ export default class ChannelView extends React.Component<
)}
{BackendUtils.isLNDBased() && (
<>
<Text
style={{
...styles.text,
color: themeColor('text')
}}
>
{localeString(
'views.Channel.closingRate'
)}
</Text>
<OnchainFeeInput
fee={satPerByte}
onChangeFee={(text: string) => {
this.setState({
satPerByte: text
});
}}
navigation={navigation}
/>
<View style={{ marginBottom: 10 }}>
<Text
style={{
...styles.text,
color: themeColor('text'),
top: 20
}}
>
{localeString(
'views.Channel.forceClose'
)}
</Text>
<Switch
value={forceCloseChannel}
onValueChange={() =>
this.setState({
forceCloseChannel:
!forceCloseChannel
})
}
/>
</View>
{!forceCloseChannel && (
<>
<Text
style={{
...styles.text,
color: themeColor('text')
}}
>
{localeString(
'views.Channel.closingRate'
)}
</Text>
<OnchainFeeInput
fee={satPerByte}
onChangeFee={(text: string) => {
this.setState({
satPerByte: text
});
}}
navigation={navigation}
/>
</>
)}
<>
<Text
style={{
Expand All @@ -749,28 +775,6 @@ export default class ChannelView extends React.Component<
locked={closingChannel}
/>
</>
<View style={{ marginBottom: 10 }}>
<Text
style={{
...styles.text,
color: themeColor('text'),
top: 20
}}
>
{localeString(
'views.Channel.forceClose'
)}
</Text>
<Switch
value={forceCloseChannel}
onValueChange={() =>
this.setState({
forceCloseChannel:
!forceCloseChannel
})
}
/>
</View>
</>
)}
<View style={styles.button}>
Expand Down

0 comments on commit 244211e

Please sign in to comment.