Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LND: handle commas when setting channel fees #991

Merged
merged 1 commit into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,14 @@ export default class LND {
this.getRequest(`/v1/graph/node/${urlParams && urlParams[0]}`);
getFees = () => this.getRequest('/v1/fees');
setFees = (data: any) => {
// handle commas in place of decimals
const base_fee_msat = data.base_fee_msat.replace(/,/g, '.');
const fee_rate = data.fee_rate.replace(/,/g, '.');

if (data.global) {
return this.postRequest('/v1/chanpolicy', {
base_fee_msat: data.base_fee_msat,
fee_rate: `${Number(data.fee_rate) / 100}`,
base_fee_msat,
fee_rate: `${Number(fee_rate) / 100}`,
global: true,
time_lock_delta: Number(data.time_lock_delta),
min_htlc_msat: data.min_htlc
Expand All @@ -269,8 +273,8 @@ export default class LND {
});
}
return this.postRequest('/v1/chanpolicy', {
base_fee_msat: data.base_fee_msat,
fee_rate: `${Number(data.fee_rate) / 100}`,
base_fee_msat,
fee_rate: `${Number(fee_rate) / 100}`,
chan_point: {
funding_txid_str: data.chan_point.funding_txid_str,
output_index: data.chan_point.output_index
Expand Down