-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3c28c9
commit ea83dd3
Showing
27 changed files
with
979 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ db.sqlite3 | |
lndg/settings.py | ||
frontend | ||
node_modules | ||
lndg-admin.txt | ||
lndg-admin.txt | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Generated by Django 3.2.7 on 2022-01-14 22:18 | ||
|
||
from django.db import migrations, models | ||
from django.db.models import F, IntegerField | ||
from django.db.models.functions import Round | ||
|
||
def update_defaults(apps, schedma_editor): | ||
channels = apps.get_model('gui', 'channels') | ||
settings = apps.get_model('gui', 'localsettings') | ||
try: | ||
if settings.objects.filter(key='AR-Target%').exists(): | ||
ar_amt_target = float(settings.objects.filter(key='AR-Target%')[0].value) | ||
else: | ||
ar_amt_target = 0.05 | ||
channels.objects.all().update(ar_amt_target=Round(F('capacity')*ar_amt_target, output_field=IntegerField())) | ||
except Exception as e: | ||
print('Migration step failed:', str(e)) | ||
try: | ||
if settings.objects.filter(key='AR-Outbound%').exists(): | ||
ar_out_target = float(settings.objects.filter(key='AR-Outbound%')[0].value) | ||
else: | ||
ar_out_target = 0.75 | ||
channels.objects.all().update(ar_out_target=ar_out_target*100) | ||
except Exception as e: | ||
print('Migration step failed:', str(e)) | ||
|
||
def revert_defaults(apps, schedma_editor): | ||
pass | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gui', '0017_autopilot'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='channels', | ||
old_name='ar_target', | ||
new_name='ar_in_target', | ||
), | ||
migrations.AddField( | ||
model_name='channels', | ||
name='ar_amt_target', | ||
field=models.BigIntegerField(default=100000), | ||
), | ||
migrations.AddField( | ||
model_name='channels', | ||
name='ar_out_target', | ||
field=models.IntegerField(default=75), | ||
), | ||
migrations.RunPython(update_defaults, revert_defaults), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
{% extends "base.html" %} | ||
{% block title %} {{ block.super }} - Advanced{% endblock %} | ||
{% block content %} | ||
{% load humanize %} | ||
{% if channels %} | ||
<div class="w3-container w3-padding-small"> | ||
<h2>Advanced Channel Settings</h2> | ||
<div class="w3-container w3-padding-small" style="overflow-x: scroll"> | ||
<table class="w3-table-all w3-centered w3-hoverable"> | ||
<tr> | ||
<th>Channel ID</th> | ||
<th>Peer Alias</th> | ||
<th>Capacity</th> | ||
<th>Outbound Liquidity</th> | ||
<th width=10%></th> | ||
<th>Inbound Liquidity</th> | ||
<th>oRate</th> | ||
<th>oBase</th> | ||
<th>iRate</th> | ||
<th>iBase</th> | ||
<th title="When AR is ENABLED for the channel, the size of the rebalance attempts that should be tried during attempts to refill the channel.">Target Amt</th> | ||
<th title="When AR is NOT ENABLED for the channel, keep pushing OUT the channel until its outbound liquidity falls below the oTarget%.">oTarget%</th> | ||
<th title="When AR is ENABLED for the channel, keep pulling IN to the channel until its inbound liquidity falls below the iTarget%.">iTarget%</th> | ||
<th title="When AR is ENABLED it will refill the channel with outbound liquidity.">AR</th> | ||
<th>Active</th> | ||
</tr> | ||
{% for channel in channels %} | ||
<tr> | ||
<td title="{{ channel.funding_txid }}:{{ channel.output_index }}"><a href="{{ network_links }}/{{ network }}tx/{{ channel.funding_txid }}" target="_blank">{{ channel.chan_id }}</a></td> | ||
<td title="{{ channel.remote_pubkey }}"><a href="{{ graph_links }}/{{ network }}node/{{ channel.remote_pubkey }}" target="_blank">{{ channel.alias }}</a></td> | ||
<td>{{ channel.capacity|intcomma }}</td> | ||
<td>{{ channel.local_balance|intcomma }} ({{ channel.out_percent }}%)</td> | ||
<td><div class="w3-orange w3-round">{% if channel.in_percent == 0 %}<div class="w3-container w3-round w3-blue" style="height:16px;width:100%"></div>{% elif channel.out_percent == 0 %}<div class="w3-container w3-round w3-orange" style="height:16px;width:100%"></div>{% else %}<div class="w3-container w3-round w3-blue" style="height:16px;width:{{ channel.out_percent }}%"></div>{% endif %}</div></td> | ||
<td>{{ channel.remote_balance|intcomma }} ({{ channel.in_percent }}%)</td> | ||
<td> | ||
<form action="/update_channel/" method="post"> | ||
{% csrf_token %} | ||
<input style="text-align:center" id="target" type="number" min="0" max="100000" name="target" value="{{ channel.local_fee_rate }}"> | ||
<input type="hidden" name="chan_id" value="{{ channel.chan_id }}"> | ||
<input type="hidden" name="update_target" value="1"> | ||
</form> | ||
</td> | ||
<td> | ||
<form action="/update_channel/" method="post"> | ||
{% csrf_token %} | ||
<input style="text-align:center" id="target" type="number" min="0" max="100000" name="target" value="{{ channel.local_base_fee }}"> | ||
<input type="hidden" name="chan_id" value="{{ channel.chan_id }}"> | ||
<input type="hidden" name="update_target" value="0"> | ||
</form> | ||
</td> | ||
<td>{{ channel.remote_fee_rate|intcomma }}</td> | ||
<td>{{ channel.remote_base_fee|intcomma }}</td> | ||
<td> | ||
<form action="/update_channel/" method="post"> | ||
{% csrf_token %} | ||
<input style="text-align:center" id="target" type="number" min="0" max="100000000" name="target" value="{{ channel.ar_amt_target }}"> | ||
<input type="hidden" name="chan_id" value="{{ channel.chan_id }}"> | ||
<input type="hidden" name="update_target" value="2"> | ||
</form> | ||
</td> | ||
<td {% if channel.auto_rebalance == False %}style="background-color: #80ced6"{% else %}style="background-color: #f18973"{% endif %}> | ||
<form action="/update_channel/" method="post"> | ||
{% csrf_token %} | ||
<input style="text-align:center" id="target" type="number" min="0" max="100" name="target" value="{{ channel.ar_out_target }}"> | ||
<input type="hidden" name="chan_id" value="{{ channel.chan_id }}"> | ||
<input type="hidden" name="update_target" value="4"> | ||
</form> | ||
</td> | ||
<td {% if channel.auto_rebalance == True %}style="background-color: #80ced6"{% else %}style="background-color: #f18973"{% endif %}> | ||
<form action="/update_channel/" method="post"> | ||
{% csrf_token %} | ||
<input style="text-align:center" id="target" type="number" min="0" max="100" name="target" value="{{ channel.ar_in_target }}"> | ||
<input type="hidden" name="chan_id" value="{{ channel.chan_id }}"> | ||
<input type="hidden" name="update_target" value="3"> | ||
</form> | ||
</td> | ||
<td> | ||
<form action="/update_channel/" method="post"> | ||
{% csrf_token %} | ||
<input type="submit" value="{% if channel.auto_rebalance == True %}Disable{% else %}Enable{% endif %}"> | ||
<input type="hidden" name="chan_id" value="{{ channel.chan_id }}"> | ||
<input type="hidden" name="update_target" value="5"> | ||
<input type="hidden" name="target" value="0"> | ||
</form> | ||
</td> | ||
<td>{{ channel.is_active }}</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% if not channels %} | ||
<div class="w3-container w3-padding-small"> | ||
<center><h1>You dont have any channels to setup yet!</h1></center> | ||
</div> | ||
{% endif %} | ||
{% if local_settings %} | ||
<div class="w3-container w3-padding-small"> | ||
<h2>Update Local Settings</h2> | ||
<table class="w3-table-all w3-centered w3-hoverable"> | ||
<tr> | ||
<th>Key</th> | ||
<th>Value</th> | ||
</tr> | ||
{% for settings in local_settings %} | ||
<tr> | ||
<td>{{ settings.key }}</td> | ||
<td> | ||
<form action="/update_setting/" method="post"> | ||
{% csrf_token %} | ||
{% if settings.key|slice:"-1:" == '%' %} | ||
<input style="text-align:center" id="value" type="number" step="0.01" min="0" max="1" name="value" value="{{ settings.value }}"> | ||
{% elif settings.key == 'AR-Time' %} | ||
<input style="text-align:center" id="value" type="number" min="0" max="60" name="value" value="{{ settings.value }}"> | ||
{% elif settings.key == 'AR-MaxFeeRate' %} | ||
<input style="text-align:center" id="value" type="number" min="0" max="2500" name="value" value="{{ settings.value }}"> | ||
{% elif settings.key|slice:":3" == 'AR-' %} | ||
<input style="text-align:center" id="value" type="number" min="0" max="1" name="value" value="{{ settings.value }}"> | ||
{% else %} | ||
<input style="text-align:center" id="value" type="text" name="value" value="{{ settings.value }}"> | ||
{% endif %} | ||
<input type="hidden" name="key" value="{{ settings.key }}"> | ||
</form> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.