Skip to content

Commit

Permalink
AutoFee: confirm 'Update All' button click
Browse files Browse the repository at this point in the history
  • Loading branch information
Impa10r committed Feb 26, 2025
1 parent d80fa31 commit 9885446
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Wait for broadcasted CaimJoin tx to appear in local mempool
- Fix channel stats not resetting after a successful swap
- Fix invoiced stats not calculating without circular rebalancing
- AutoFee: confirm 'Update All' button click

## 1.7.7

Expand Down
13 changes: 11 additions & 2 deletions cmd/psweb/templates/af.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
style="color:{{.RedColor}}"
{{end}}>{{.LocalPct}}% local</span>, <span style="border-bottom: 2px dashed grey;">Current fee rate: {{fs .FeeRate}}</span>{{if .HasInboundFees}}, Inbound rate: {{.InboundRate}}{{end}}</p>
{{end}}
<form id="myForm" autocomplete="off" action="/submit" method="post" onsubmit="return confirmSubmit()">
<form id="myForm" autocomplete="off" action="/submit" method="post" onsubmit="return confirmSubmit(event)">
<input autocomplete="false" name="hidden" type="text" style="display:none;">
<table style="width:100%; table-layout:fixed; margin-bottom: 0.5em">
<tr>
Expand Down Expand Up @@ -419,7 +419,16 @@
document.getElementById(formId).submit();
}
// warning message if Max HTLC % > 0
function confirmSubmit() {
function confirmSubmit(event) {
// Detect the clicked button
const clickedButton = event.submitter; // Modern browsers support this
if (clickedButton.name == 'update_all') {
var confirmed = confirm("This will update fee rules with highlighted values for all the channels. Are you sure?");
if (!confirmed) {
// user cancels, prevent form submission
return false;
}
}
if (Number(document.getElementById("maxHtlcPct").value)>0) {
var confirmed = confirm("Setting Max HTLC size to a % of Local Balance will only take effect when Local Balance exceeds 50% of Capacity. Still, reducing Max HTLC can prevent receiving certain large swaps and inbound payments. A better way to avoid failed HTLCs is to bump channel's fee rate upon every fail. Please confirm if you still want to set Max HTLC % > 0.");
if (!confirmed) {
Expand Down

0 comments on commit 9885446

Please sign in to comment.