Skip to content

Commit

Permalink
feat(images): add support for Eclair v0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jamaljsr committed Mar 6, 2024
1 parent 8fc8923 commit 3dfb153
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Supported Network Node Versions:

- [LND](https://github.com/lightningnetwork/lnd) - v0.17.4, v0.17.3, v0.17.2, v0.17.1, v0.17.0, v0.16.4, v0.16.2, v0.16.1, v0.16.0, v0.15.5, v0.14.3, v0.13.1
- [Core Lightning](https://github.com/ElementsProject/lightning) - v23.05.2, v23.02.2, v22.11, v0.12.0, v0.11.2, v0.10.2
- [Eclair](https://github.com/ACINQ/eclair/) - v0.9.0, v0.8.0, v0.7.0, v0.6.2, v0.5.0
- [Eclair](https://github.com/ACINQ/eclair/) - v0.10.0, v0.9.0, v0.8.0, v0.7.0, v0.6.2, v0.5.0
- [Bitcoin Core](https://github.com/bitcoin/bitcoin) - v26.0, v25.0, v24.0, v23.0, v22.0, v0.21.1
- [Taproot Assets](https://github.com/lightninglabs/taproot-assets) - v0.3.0

Expand Down
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Replace `<version>` with the desired c-lightning version (ex: `0.8.0`).

### Tags

- `0.10.0` ([eclair/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/eclair/Dockerfile))
- `0.9.0` ([eclair/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/eclair/Dockerfile))
- `0.8.0` ([eclair/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/eclair/Dockerfile))
- `0.7.0` ([eclair/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/eclair/Dockerfile))
Expand Down
4 changes: 2 additions & 2 deletions docker/nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"versions": ["23.05.2", "23.02.2", "22.11", "0.12.0", "0.11.2", "0.10.2"]
},
"eclair": {
"latest": "0.9.0",
"versions": ["0.9.0", "0.8.0", "0.7.0", "0.6.2", "0.5.0"]
"latest": "0.10.0",
"versions": ["0.10.0", "0.9.0", "0.8.0", "0.7.0", "0.6.2", "0.5.0"]
},
"bitcoind": {
"latest": "26.0",
Expand Down
19 changes: 12 additions & 7 deletions src/lib/lightning/eclair/eclairService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('EclairService', () => {
});

it('should get a list of channels for v0.7.0', async () => {
node.version = '0.7.0';
const node7 = { ...node, version: '0.7.0' };
const chanResponse: ELN.ChannelResponse = {
nodeId: 'abcdef',
channelId: '65sdfd7',
Expand Down Expand Up @@ -117,12 +117,12 @@ describe('EclairService', () => {
};
eclairApiMock.httpPost.mockResolvedValue([chanResponse]);
const expected = [expect.objectContaining({ pubkey: 'abcdef' })];
const actual = await eclairService.getChannels(node);
const actual = await eclairService.getChannels(node7);
expect(actual).toEqual(expected);
});

it('should get a list of channels for v0.8.0', async () => {
node.version = '0.8.0';
const node8 = { ...node, version: '0.8.0' };
const chanResponse: ELN.ChannelResponse = {
nodeId: 'abcdef',
channelId: '65sdfd7',
Expand Down Expand Up @@ -171,12 +171,12 @@ describe('EclairService', () => {
};
eclairApiMock.httpPost.mockResolvedValue([chanResponse]);
const expected = [expect.objectContaining({ pubkey: 'abcdef' })];
const actual = await eclairService.getChannels(node);
const actual = await eclairService.getChannels(node8);
expect(actual).toEqual(expected);
});

it('should get a list of channels for >= v0.9.0', async () => {
node.version = '0.9.0';
const node9 = { ...node, version: '0.9.0' };
const chanResponse: ELN.ChannelResponse = {
nodeId: 'abcdef',
channelId: '65sdfd7',
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('EclairService', () => {
};
eclairApiMock.httpPost.mockResolvedValue([chanResponse]);
const expected = [expect.objectContaining({ pubkey: 'abcdef' })];
const actual = await eclairService.getChannels(node);
const actual = await eclairService.getChannels(node9);
expect(actual).toEqual(expected);
});

Expand Down Expand Up @@ -313,7 +313,12 @@ describe('EclairService', () => {
version: defaultRepoState.images.eclair.latest,
},
'open',
{ channelFlags: 0, fundingSatoshis: 100000, nodeId: 'abc' },
{
channelFlags: 0,
fundingSatoshis: 100000,
fundingFeeBudgetSatoshis: 50000,
nodeId: 'abc',
},
);
});

Expand Down
5 changes: 4 additions & 1 deletion src/lib/lightning/eclair/eclairService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ class EclairService implements LightningService {
const [toPubKey] = toRpcUrl.split('@');

// open the channel
const capacity = parseInt(amount);
const body: ELN.OpenChannelRequest = {
nodeId: toPubKey,
fundingSatoshis: parseInt(amount),
fundingSatoshis: capacity,
// regtest fee estimation is unusually high so increase the budget to 50% of capacity
fundingFeeBudgetSatoshis: Math.round(capacity * 0.5),
channelFlags: isPrivate ? 0 : 1, // 0 is private, 1 is public: https://acinq.github.io/eclair/#open-2
};
const res = await httpPost<string>(from, 'open', body);
Expand Down
1 change: 1 addition & 0 deletions src/lib/lightning/eclair/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export interface OpenChannelRequest {
fundingSatoshis: number;
pushMsat?: number;
fundingFeerateSatByte?: number;
fundingFeeBudgetSatoshis: number;
channelFlags?: ChannelFlags;
openTimeoutSeconds?: number;
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ export const defaultRepoState: DockerRepoState = {
versions: ['23.05.2', '23.02.2', '22.11', '0.12.0', '0.11.2', '0.10.2'],
},
eclair: {
latest: '0.9.0',
versions: ['0.9.0', '0.8.0', '0.7.0', '0.6.2', '0.5.0'],
latest: '0.10.0',
versions: ['0.10.0', '0.9.0', '0.8.0', '0.7.0', '0.6.2', '0.5.0'],
},
bitcoind: {
latest: '26.0',
Expand Down
4 changes: 2 additions & 2 deletions src/utils/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ export const testRepoState: DockerRepoState = {
versions: ['23.05.2', '23.02.2', '22.11', '0.12.0', '0.11.2', '0.10.2'],
},
eclair: {
latest: '0.9.0',
versions: ['0.9.0', '0.8.0', '0.7.0', '0.6.2', '0.5.0'],
latest: '0.10.0',
versions: ['0.10.0', '0.9.0', '0.8.0', '0.7.0', '0.6.2', '0.5.0'],
},
bitcoind: {
latest: '26.0',
Expand Down

0 comments on commit 3dfb153

Please sign in to comment.