Skip to content

Commit cc84f1c

Browse files
committed
feat: add simln support to eclair
1 parent ab1b575 commit cc84f1c

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed

src/components/designer/default/AddSimulationModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const AddSimulationModal: React.FC<Props> = ({ network }) => {
105105
name="source"
106106
label={l('source')}
107107
nodeStatus={Status.Started}
108-
implementation={'LND'}
108+
implementation={['LND', 'eclair']}
109109
nodes={nodes}
110110
/>
111111
</Col>
@@ -115,7 +115,7 @@ const AddSimulationModal: React.FC<Props> = ({ network }) => {
115115
name="destination"
116116
label={l('destination')}
117117
nodeStatus={Status.Started}
118-
implementation={'LND'}
118+
implementation={['LND', 'eclair']}
119119
nodes={nodes}
120120
/>
121121
</Col>

src/lib/docker/dockerService.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -884,9 +884,9 @@ describe('DockerService', () => {
884884
id: 1,
885885
name: 'my network',
886886
description: 'network description',
887-
lndNodes: 2,
888-
clightningNodes: 1,
889-
eclairNodes: 0,
887+
lndNodes: 1,
888+
clightningNodes: 0,
889+
eclairNodes: 1,
890890
bitcoindNodes: 1,
891891
tapdNodes: 0,
892892
litdNodes: 0,
@@ -896,13 +896,15 @@ describe('DockerService', () => {
896896
});
897897
const mockResult = { err: '', out: '', exitCode: 0 };
898898
const lndNodes = network.nodes.lightning.filter(n => n.implementation === 'LND');
899-
899+
const eclairNodes = network.nodes.lightning.filter(
900+
n => n.implementation === 'eclair',
901+
);
900902
beforeEach(() => {
901903
// Add simulation config to the test network
902904
network.simulation = {
903905
networkId: 1,
904906
source: lndNodes[0],
905-
destination: lndNodes[1],
907+
destination: eclairNodes[0],
906908
intervalSecs: 60,
907909
amountMsat: 1000,
908910
status: Status.Stopped,

src/lib/docker/dockerService.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
SimulationNodeConfig,
2828
} from 'types';
2929
import { legacyDataPath, networksPath, nodePath } from 'utils/config';
30-
import { APP_VERSION, dockerConfigs } from 'utils/constants';
30+
import { APP_VERSION, dockerConfigs, eclairCredentials } from 'utils/constants';
3131
import { exists, read, renameFile, rm, write } from 'utils/files';
3232
import { migrateNetworksFile } from 'utils/migrations';
3333
import { isLinux, isMac } from 'utils/system';
@@ -434,6 +434,16 @@ class DockerService implements DockerLibrary {
434434
};
435435
break;
436436

437+
case 'eclair':
438+
const eclair = node as EclairNode;
439+
simNode = {
440+
id: eclair.name,
441+
base_url: `http://host.docker.internal:${eclair.ports.rest}`,
442+
api_username: '',
443+
api_password: eclairCredentials.pass,
444+
};
445+
break;
446+
437447
default:
438448
throw new Error(`unsupported node implementation: ${node.implementation}`);
439449
}

src/types/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,13 @@ export interface SimulationConfig {
323323

324324
export interface SimulationNodeConfig {
325325
id: string;
326-
address: string;
327-
macaroon: string;
326+
address?: string;
327+
base_url?: string;
328+
macaroon?: string;
328329
cert?: string;
330+
ca_cert?: string;
331+
client_cert?: string;
332+
client_key?: string;
333+
api_username?: string;
334+
api_password?: string;
329335
}

src/utils/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export const dockerConfigs: Record<NodeImplementationWithSimln, DockerConfig> =
191191
'--on-chain-fees.feerate-tolerance.ratio-high=10000.0',
192192
'--channel.max-htlc-value-in-flight-percent=100',
193193
'--channel.max-htlc-value-in-flight-msat=5000000000000', // 50 BTC in msats
194+
'--features.keysend=optional',
194195
].join('\n '),
195196
// if vars are modified, also update composeFile.ts & the i18n strings for cmps.nodes.CommandVariables
196197
variables: ['name', 'eclairPass', 'backendName', 'rpcUser', 'rpcPass'],
@@ -322,7 +323,7 @@ export const dockerConfigs: Record<NodeImplementationWithSimln, DockerConfig> =
322323
},
323324
simln: {
324325
name: 'simln',
325-
imageName: 'bitcoindevproject/simln:0.2.0',
326+
imageName: 'bitcoindevproject/simln:0.2.4',
326327
logo: '',
327328
platforms: ['mac', 'linux', 'windows'],
328329
volumeDirName: 'simln',

0 commit comments

Comments
 (0)