Unverified Commit daaf6b9e authored by Tankred Hase's avatar Tankred Hase Committed by GitHub

Merge pull request #1090 from lightninglabs/dev/fix-pending-commit-fee

Dev/fix pending commit fee
parents a61d3c4b 134f0eb4
......@@ -137,7 +137,6 @@ class ChannelAction {
capacity: channel.capacity,
localBalance: channel.localBalance,
remoteBalance: channel.remoteBalance,
commitFee: channel.commitFee || 0,
channelPoint: channel.channelPoint,
fundingTxId: this._parseChannelPoint(channel.channelPoint)
.fundingTxidStr,
......@@ -146,6 +145,7 @@ class ChannelAction {
...mapPendingAttributes(poc.channel),
confirmationHeight: poc.confirmationHeight,
blocksTillOpen: poc.blocksTillOpen,
commitFee: poc.commitFee,
feePerKw: poc.feePerKw,
status: 'pending-open',
}));
......
......@@ -144,6 +144,7 @@ store.channels = [...Array(4)].map(() => ({
capacity: 2005000,
localBalance: 1990000,
remoteBalance: 10000,
commitFee: 0,
channelPoint:
'3511ae8a52c97d957eaf65f828504e68d0991f0276adff94c6ba91c7f6cd4275',
active: true,
......@@ -157,6 +158,7 @@ store.pendingChannels = [...Array(6)].map((x, i) => ({
capacity: 1005000,
localBalance: 600000,
remoteBalance: 400000,
commitFee: 0,
channelPoint:
'3511ae8a52c97d957eaf65f828504e68d0991f0276adff94c6ba91c7f6cd4275',
status: i % 2 === 0 ? 'pending-closing' : 'pending-open',
......
......@@ -68,7 +68,7 @@ const ComputedChannel = store => {
get channelBalanceClosingSatoshis() {
return (store.pendingChannels || [])
.filter(c => !c.status.includes('open'))
.map(c => c.localBalance + c.commitFee)
.map(c => c.localBalance)
.reduce((a, b) => a + b, 0);
},
get channelBalanceClosingLabel() {
......@@ -78,7 +78,7 @@ const ComputedChannel = store => {
get channelBalanceForceClosingSatoshis() {
return (store.pendingChannels || [])
.filter(c => c.status === 'pending-force-closing')
.map(c => c.localBalance + c.commitFee)
.map(c => c.localBalance)
.reduce((a, b) => a + b, 0);
},
get channelBalanceForceClosingLabel() {
......
......@@ -350,6 +350,7 @@ store.channels = [...Array(4)].map((x, i) => ({
capacity: 2005000,
localBalance: 1990000,
remoteBalance: 10000,
commitFee: 0,
channelPoint:
'3511ae8a52c97d957eaf65f828504e68d0991f0276adff94c6ba91c7f6cd4275',
active: i % 2 === 0 ? true : false,
......@@ -363,6 +364,7 @@ store.pendingChannels = [...Array(6)].map((x, i) => ({
capacity: 1005000,
localBalance: 600000,
remoteBalance: 400000,
commitFee: 0,
channelPoint:
'3511ae8a52c97d957eaf65f828504e68d0991f0276adff94c6ba91c7f6cd4275',
status: i % 2 === 0 ? 'pending-closing' : 'pending-open',
......
......@@ -143,13 +143,14 @@ describe('Action Channels Unit Tests', () => {
capacity: 100,
localBalance: 10,
remoteBalance: 90,
commitFee: 15,
channelPoint: 'FFFF:1',
};
it('should list pending channels', async () => {
grpc.sendCommand.withArgs('pendingChannels').resolves({
pendingOpenChannels: [{ channel: { ...pendingChannel } }],
pendingOpenChannels: [
{ channel: { ...pendingChannel }, commitFee: 15 },
],
pendingClosingChannels: [{ channel: { ...pendingChannel } }],
pendingForceClosingChannels: [
{
......
......@@ -46,7 +46,6 @@ describe('Computed Channels Unit Tests', () => {
capacity: 805000,
localBalance: 500000,
remoteBalance: 300000,
commitFee: 200,
channelPoint: 'some-channel-point',
status: 'pending-closing',
});
......@@ -56,7 +55,6 @@ describe('Computed Channels Unit Tests', () => {
capacity: 705000,
localBalance: 400000,
remoteBalance: 300000,
commitFee: 100,
channelPoint: 'some-channel-point',
status: 'pending-force-closing',
});
......@@ -102,12 +100,8 @@ describe('Computed Channels Unit Tests', () => {
expect(store.channelBalanceOpenLabel, 'to match', /^0[,.]019905$/);
expect(store.channelBalanceInactiveLabel, 'to match', /^0[,.]019904$/);
expect(store.channelBalancePendingLabel, 'to match', /^0[,.]006003$/);
expect(store.channelBalanceClosingLabel, 'to match', /^0[,.]009003$/);
expect(
store.channelBalanceForceClosingLabel,
'to match',
/^0[,.]004001$/
);
expect(store.channelBalanceClosingLabel, 'to match', /^0[,.]009$/);
expect(store.channelBalanceForceClosingLabel, 'to match', /^0[,.]004$/);
expect(store.channelStatus, 'to equal', 'success');
});
......@@ -123,8 +117,8 @@ describe('Computed Channels Unit Tests', () => {
expect(store.channelBalanceOpenLabel, 'to match', /137[,.]25/);
expect(store.channelBalanceInactiveLabel, 'to match', /137[,.]24/);
expect(store.channelBalancePendingLabel, 'to match', /41[,.]39/);
expect(store.channelBalanceClosingLabel, 'to match', /62[,.]08/);
expect(store.channelBalanceForceClosingLabel, 'to match', /27[,.]59/);
expect(store.channelBalanceClosingLabel, 'to match', /62[,.]06/);
expect(store.channelBalanceForceClosingLabel, 'to match', /27[,.]58/);
});
it('should display pending status', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment