Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 6ae9e66

Browse files
Merge pull request #539 from lightninglabs/update-wallet-on-channel-event
Update wallet on channel event
2 parents ca8c9ac + a3a4fa6 commit 6ae9e66

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/action/channel.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import { toSatoshis, parseSat } from '../helper';
77
import * as log from './log';
88

99
class ChannelAction {
10-
constructor(store, grpc, nav, notification) {
10+
constructor(store, grpc, transaction, nav, notification) {
1111
this._store = store;
1212
this._grpc = grpc;
13+
this._transaction = transaction;
1314
this._nav = nav;
1415
this._notification = notification;
1516
}
@@ -83,6 +84,7 @@ class ChannelAction {
8384
this.getPeers(),
8485
this.getChannels(),
8586
this.getPendingChannels(),
87+
this._transaction.update(),
8688
]);
8789
}
8890

src/action/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export const grpc = new GrpcAction(store, ipc);
3636
export const notify = new NotificationAction(store, nav);
3737
export const wallet = new WalletAction(store, grpc, db, nav, notify);
3838
export const info = new InfoAction(store, grpc, nav, notify);
39-
export const channel = new ChannelAction(store, grpc, nav, notify);
4039
export const transaction = new TransactionAction(store, grpc, wallet, nav);
40+
export const channel = new ChannelAction(store, grpc, transaction, nav, notify);
4141
export const invoice = new InvoiceAction(
4242
store,
4343
grpc,

stories/screen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const payment = new PaymentAction(store, grpc, transaction, nav, notify);
8080
sinon.stub(payment, 'checkType');
8181
sinon.stub(payment, 'payBitcoin');
8282
sinon.stub(payment, 'payLightning');
83-
const channel = new ChannelAction(store, grpc, nav, notify);
83+
const channel = new ChannelAction(store, grpc, transaction, nav, notify);
8484
sinon.stub(channel, 'update');
8585
sinon.stub(channel, 'connectAndOpen');
8686
sinon.stub(channel, 'closeSelectedChannel');

test/integration/action/action-integration.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ describe('Action Integration Tests', function() {
151151
grpc1 = new GrpcAction(store1, ipc1);
152152
info1 = new InfoAction(store1, grpc1, nav1, notify1);
153153
wallet1 = new WalletAction(store1, grpc1, db1, nav1, notify1);
154-
channels1 = new ChannelAction(store1, grpc1, nav1, notify1);
155154
transactions1 = new TransactionAction(store1, grpc1, wallet1, nav1);
155+
channels1 = new ChannelAction(store1, grpc1, transactions1, nav1, notify1);
156156
invoice1 = new InvoiceAction(store1, grpc1, transactions1, nav1, notify1);
157157
payments1 = new PaymentAction(store1, grpc1, transactions1, nav1, notify1);
158158

@@ -163,8 +163,8 @@ describe('Action Integration Tests', function() {
163163
grpc2 = new GrpcAction(store2, ipc2);
164164
info2 = new InfoAction(store2, grpc2, nav2, notify2);
165165
wallet2 = new WalletAction(store2, grpc2, db2, nav2, notify2);
166-
channels2 = new ChannelAction(store2, grpc2, nav2, notify2);
167166
transactions2 = new TransactionAction(store2, grpc2, wallet2, nav2);
167+
channels2 = new ChannelAction(store2, grpc2, transactions2, nav2, notify2);
168168
invoice2 = new InvoiceAction(store2, grpc2, transactions2, nav2, notify2);
169169
payments2 = new PaymentAction(store2, grpc2, transactions2, nav2, notify2);
170170
});

test/unit/action/channel.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Store } from '../../../src/store';
22
import GrpcAction from '../../../src/action/grpc';
33
import ChannelAction from '../../../src/action/channel';
4+
import TransactionAction from '../../../src/action/transaction';
45
import NotificationAction from '../../../src/action/notification';
56
import NavAction from '../../../src/action/nav';
67
import * as logger from '../../../src/action/log';
@@ -15,6 +16,7 @@ describe('Action Channels Unit Tests', () => {
1516
let grpc;
1617
let channel;
1718
let nav;
19+
let transaction;
1820
let notification;
1921

2022
beforeEach(() => {
@@ -24,9 +26,10 @@ describe('Action Channels Unit Tests', () => {
2426
store.settings.displayFiat = false;
2527
require('../../../src/config').RETRY_DELAY = 1;
2628
grpc = sinon.createStubInstance(GrpcAction);
29+
transaction = sinon.createStubInstance(TransactionAction);
2730
notification = sinon.createStubInstance(NotificationAction);
2831
nav = sinon.createStubInstance(NavAction);
29-
channel = new ChannelAction(store, grpc, nav, notification);
32+
channel = new ChannelAction(store, grpc, transaction, nav, notification);
3033
});
3134

3235
afterEach(() => {
@@ -82,6 +85,7 @@ describe('Action Channels Unit Tests', () => {
8285
it('should refresh channels and peers', async () => {
8386
await channel.update();
8487
expect(grpc.sendCommand, 'was called thrice');
88+
expect(transaction.update, 'was called once');
8589
});
8690
});
8791

0 commit comments

Comments
 (0)