forked from cryptosharks131/lndg
-
Notifications
You must be signed in to change notification settings - Fork 0
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
53e5858
commit c63c065
Showing
29 changed files
with
1,382 additions
and
330 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build on push | ||
|
||
permissions: | ||
packages: write | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
name: Build image | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env variables | ||
run: | | ||
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV | ||
IMAGE_NAME="${GITHUB_REPOSITORY#*/}" | ||
echo "IMAGE_NAME=${IMAGE_NAME//docker-/}" >> $GITHUB_ENV | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
id: qemu | ||
|
||
- name: Setup Docker buildx action | ||
uses: docker/setup-buildx-action@v2 | ||
id: buildx | ||
|
||
- name: Run Docker buildx | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest \ | ||
--output "type=registry" ./ |
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,47 @@ | ||
name: Build on tag | ||
|
||
permissions: | ||
packages: write | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
- v[0-9]+.[0-9]+.[0-9]+-* | ||
|
||
jobs: | ||
build: | ||
name: Build image | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set env variables | ||
run: | | ||
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | ||
IMAGE_NAME="${GITHUB_REPOSITORY#*/}" | ||
echo "IMAGE_NAME=${IMAGE_NAME//docker-/}" >> $GITHUB_ENV | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
id: qemu | ||
|
||
- name: Setup Docker buildx action | ||
uses: docker/setup-buildx-action@v2 | ||
id: buildx | ||
|
||
- name: Run Docker buildx | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$TAG \ | ||
--output "type=registry" ./ |
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,70 @@ | ||
# Generated by Django 3.2.7 on 2022-07-21 05:57 | ||
|
||
from django.db import migrations, models | ||
from requests import get | ||
from lndg.settings import LND_NETWORK | ||
|
||
def update_close_fees(apps, schedma_editor): | ||
channels = apps.get_model('gui', 'channels') | ||
closures = apps.get_model('gui', 'closures') | ||
resolutions = apps.get_model('gui', 'resolutions') | ||
settings = apps.get_model('gui', 'localsettings') | ||
def network_links(): | ||
if settings.objects.filter(key='GUI-NetLinks').exists(): | ||
network_links = str(settings.objects.filter(key='GUI-NetLinks')[0].value) | ||
else: | ||
network_links = 'https://mempool.space' | ||
return network_links | ||
def get_tx_fees(txid): | ||
base_url = network_links() + ('/testnet' if LND_NETWORK == 'testnet' else '') + '/api/tx/' | ||
try: | ||
request_data = get(base_url + txid).json() | ||
fee = request_data['fee'] | ||
except Exception as e: | ||
print('Error getting closure fees for', txid, '-', str(e)) | ||
fee = 0 | ||
return fee | ||
try: | ||
for closure in closures.objects.exclude(open_initiator=2, close_type=0): | ||
if channels.objects.filter(chan_id=closure.chan_id).exists(): | ||
channel = channels.objects.filter(chan_id=closure.chan_id)[0] | ||
closing_costs = get_tx_fees(closure.closing_tx) if closure.open_initiator == 1 else 0 | ||
for resolution in resolutions.objects.filter(chan_id=closure.chan_id).exclude(resolution_type=2): | ||
closing_costs += get_tx_fees(resolution.sweep_txid) | ||
channel.closing_costs = closing_costs | ||
channel.save() | ||
except Exception as e: | ||
print('Migration step failed:', str(e)) | ||
|
||
def revert_close_fees(apps, schedma_editor): | ||
pass | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gui', '0029_update_percent_vars'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='channels', | ||
name='closing_costs', | ||
field=models.IntegerField(default=0), | ||
), | ||
migrations.AddField( | ||
model_name='rebalancer', | ||
name='fees_paid', | ||
field=models.FloatField(default=None, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='channels', | ||
name='ar_in_target', | ||
field=models.IntegerField(), | ||
), | ||
migrations.AlterField( | ||
model_name='channels', | ||
name='auto_fees', | ||
field=models.BooleanField(), | ||
), | ||
migrations.RunPython(update_close_fees, revert_close_fees), | ||
] |
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,33 @@ | ||
# Generated by Django 3.2.7 on 2022-08-05 11:21 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gui', '0030_auto_20220722_0912'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PendingChannels', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('funding_txid', models.CharField(max_length=64)), | ||
('output_index', models.IntegerField()), | ||
('local_base_fee', models.IntegerField(default=None, null=True)), | ||
('local_fee_rate', models.IntegerField(default=None, null=True)), | ||
('local_cltv', models.IntegerField(default=None, null=True)), | ||
('auto_rebalance', models.BooleanField(default=None, null=True)), | ||
('ar_amt_target', models.BigIntegerField(default=None, null=True)), | ||
('ar_in_target', models.IntegerField(default=None, null=True)), | ||
('ar_out_target', models.IntegerField(default=None, null=True)), | ||
('ar_max_cost', models.IntegerField(default=None, null=True)), | ||
('auto_fees', models.BooleanField(default=None, null=True)), | ||
], | ||
options={ | ||
'unique_together': {('funding_txid', 'output_index')}, | ||
}, | ||
), | ||
] |
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
Oops, something went wrong.