Skip to content

Commit

Permalink
Merge pull request #1305 from Ride-The-Lightning/lnd-taproot
Browse files Browse the repository at this point in the history
LND Taproot Channel
  • Loading branch information
ShahanaFarooqui authored Oct 5, 2023
2 parents 53eb5f0 + 74af120 commit ed5a493
Show file tree
Hide file tree
Showing 21 changed files with 73 additions and 29 deletions.
4 changes: 4 additions & 0 deletions backend/controllers/lnd/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ export const postChannel = (req, res, next) => {
else if (req.body.trans_type === '2') {
options.form.sat_per_byte = req.body.trans_type_value;
}
if (req.body.commitment_type) {
options.form.commitment_type = req.body.commitment_type;
}
options.form = JSON.stringify(options.form);
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Channel Open Options', data: options.form });
request.post(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Channel Opened', data: body });
res.status(201).json(body);
Expand Down
1 change: 0 additions & 1 deletion frontend/636.608e564c7da96d80.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/636.c605e62991998b93.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<link i18n-rel="" rel="mask-icon" href="assets/images/favicon-light/safari-pinned-tab.svg" color="#5bbad5">
<meta i18n-content="" name="msapplication-TileColor" content="#da532c">
<meta i18n-content="" name="theme-color" content="#ffffff">
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.7bc5ffcb3b65f807.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.7bc5ffcb3b65f807.css"></noscript></head>
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.a129e1d501647e70.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.a129e1d501647e70.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.4a54aecb0b8a9e1b.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.c5564c81d78ecdc2.js" type="module"></script>
<script src="runtime.ac7ad551891b54ee.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.31a5aa400eae5089.js" type="module"></script>

</body></html>
1 change: 1 addition & 0 deletions frontend/main.31a5aa400eae5089.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/main.c5564c81d78ecdc2.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/runtime.4a54aecb0b8a9e1b.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/runtime.ac7ad551891b54ee.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion frontend/styles.7bc5ffcb3b65f807.css

This file was deleted.

1 change: 1 addition & 0 deletions frontend/styles.a129e1d501647e70.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions server/controllers/lnd/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ export const postChannel = (req, res, next) => {
} else if (req.body.trans_type === '2') {
options.form.sat_per_byte = req.body.trans_type_value;
}
if (req.body.commitment_type) {
options.form.commitment_type = req.body.commitment_type;
}
options.form = JSON.stringify(options.form);
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Channel Open Options', data: options.form });
request.post(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Channel Opened', data: body });
res.status(201).json(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { CommonService } from '../../../shared/services/common.service';
export class OnChainReceiveComponent implements OnInit, OnDestroy {

public addressTypes = <any>[];
public selectedAddressType: AddressType = ADDRESS_TYPES[0];
public selectedAddressType: AddressType = ADDRESS_TYPES[2];
public newAddress = '';
public flgVersionCompatible = true;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@
</mat-form-field>
</div>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between center">
<div *ngIf="isTaprootAvailable" fxFlex="50" fxLayoutAlign="start center">
<mat-slide-toggle tabindex="6" color="primary" name="taprootChannel" [(ngModel)]="taprootChannel">Taproot Channel</mat-slide-toggle>
</div>
<div fxFlex="50" fxLayoutAlign="start center">
<mat-slide-toggle tabindex="6" color="primary" name="spendUnconfirmed" [(ngModel)]="spendUnconfirmed">Spend Unconfirmed Output</mat-slide-toggle>
<mat-slide-toggle tabindex="7" color="primary" name="spendUnconfirmed" [(ngModel)]="spendUnconfirmed">Spend Unconfirmed Output</mat-slide-toggle>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { mockCLEffects, mockECLEffects, mockLNDEffects, mockMatDialogRef, mockRTLEffects } from '../../../../shared/test-helpers/mock-services';
import { mockCLEffects, mockECLEffects, mockLNDEffects, mockMatDialogRef, mockRTLEffects, mockDataService } from '../../../../shared/test-helpers/mock-services';
import { SharedModule } from '../../../../shared/shared.module';
import { RTLEffects } from '../../../../store/rtl.effects';
import { CommonService } from '../../../../shared/services/common.service';
import { DataService } from '../../../../shared/services/data.service';

import { RootReducer } from '../../../../store/rtl.reducers';
import { LNDReducer } from '../../../../lnd/store/lnd.reducers';
Expand All @@ -27,9 +29,11 @@ describe('OpenChannelComponent', () => {
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
CommonService,
{ provide: MatDialogRef, useClass: mockMatDialogRef },
{ provide: MAT_DIALOG_DATA, useValue: { message: {} } },
{ provide: RTLEffects, useClass: mockRTLEffects }
{ provide: MAT_DIALOG_DATA, useValue: { message: { information: {} } } },
{ provide: RTLEffects, useClass: mockRTLEffects },
{ provide: DataService, useClass: mockDataService }
]
}).
compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { RTLState } from '../../../../store/rtl.state';
import { saveNewChannel } from '../../../store/lnd.actions';
import { SelNodeChild } from '../../../../shared/models/RTLconfig';
import { lndNodeSettings } from '../../../store/lnd.selector';
import { CommonService } from 'src/app/shared/services/common.service';

@Component({
selector: 'rtl-open-channel',
Expand All @@ -41,24 +42,28 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
public selectedPubkey = '';
public isPrivate = false;
public selTransType = '0';
public isTaprootAvailable = false;
public taprootChannel = false;
public spendUnconfirmed = false;
public transTypeValue = '';
public transTypes = TRANS_TYPES;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];

constructor(public dialogRef: MatDialogRef<OpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: OpenChannelAlert, private store: Store<RTLState>, private actions: Actions) { }
constructor(public dialogRef: MatDialogRef<OpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: OpenChannelAlert, private store: Store<RTLState>, private actions: Actions, private commonService: CommonService) { }

ngOnInit() {
if (this.data.message) {
this.information = this.data.message.information;
this.totalBalance = this.data.message.balance;
this.peer = this.data.message.peer || null;
this.peers = this.data.message.peers || [];
this.isTaprootAvailable = this.commonService.isVersionCompatible(this.information.version, '0.17.0');
} else {
this.information = {};
this.totalBalance = 0;
this.peer = null;
this.peers = [];
this.isTaprootAvailable = false;
}
this.alertTitle = this.data.alertTitle || 'Alert';
this.store.select(lndNodeSettings).pipe(takeUntil(this.unSubs[0])).
Expand Down Expand Up @@ -123,6 +128,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
this.selectedPeer.setValue('');
this.fundingAmount = null;
this.isPrivate = !!this.selNode?.unannouncedChannels;
this.taprootChannel = false;
this.spendUnconfirmed = false;
this.selTransType = '0';
this.transTypeValue = '';
Expand All @@ -135,10 +141,11 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
if ((!this.peer && !this.selectedPubkey) || (!this.fundingAmount || ((this.totalBalance - this.fundingAmount) < 0) || ((this.selTransType === '1' || this.selTransType === '2') && !this.transTypeValue))) {
return true;
}
// Taproot channel's commitment type is 5
this.store.dispatch(saveNewChannel({
payload: {
selectedPeerPubkey: ((!this.peer || !this.peer.pub_key) ? this.selectedPubkey : this.peer.pub_key), fundingAmount: this.fundingAmount, private: this.isPrivate,
transType: this.selTransType, transTypeValue: this.transTypeValue, spendUnconfirmed: this.spendUnconfirmed
transType: this.selTransType, transTypeValue: this.transTypeValue, spendUnconfirmed: this.spendUnconfirmed, commitmentType: (this.taprootChannel ? 5 : null)
}
}));
}
Expand All @@ -147,7 +154,7 @@ export class OpenChannelComponent implements OnInit, OnDestroy {
if (isClosed) {
this.advancedTitle = 'Advanced Options | ' + (this.selTransType === '1' ? 'Target Confirmation Blocks: ' : this.selTransType === '2' ?
'Fee (Sats/vByte): ' : 'Default') + ((this.selTransType === '1' || this.selTransType === '2') ? this.transTypeValue : '') +
' | Spend Unconfirmed Output: ' + (this.spendUnconfirmed ? 'Yes' : 'No');
' | Taproot Channel: ' + (this.taprootChannel ? 'Yes' : 'No') + ' | Spend Unconfirmed Output: ' + (this.spendUnconfirmed ? 'Yes' : 'No');
} else {
this.advancedTitle = 'Advanced Options';
}
Expand Down
Loading

0 comments on commit ed5a493

Please sign in to comment.