Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
lightning-bits
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
lightning-bits
Commits
9946311f
Unverified
Commit
9946311f
authored
Apr 27, 2019
by
valentinewallace
Committed by
GitHub
Apr 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1081 from lightninglabs/dev/remove-redundant-getinfo
Remove getInfo call from autopilot action
parents
0ada925f
95ea3fc2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
14 deletions
+8
-14
autopilot.js
src/action/autopilot.js
+3
-5
index-mobile.js
src/action/index-mobile.js
+1
-1
index.js
src/action/index.js
+1
-1
action-integration.spec.js
test/integration/action/action-integration.spec.js
+2
-2
autopilot.spec.js
test/unit/action/autopilot.spec.js
+1
-5
No files found.
src/action/autopilot.js
View file @
9946311f
...
@@ -8,10 +8,9 @@ import { poll, checkHttpStatus } from '../helper';
...
@@ -8,10 +8,9 @@ import { poll, checkHttpStatus } from '../helper';
import
*
as
log
from
'./log'
;
import
*
as
log
from
'./log'
;
class
AtplAction
{
class
AtplAction
{
constructor
(
store
,
grpc
,
info
,
db
,
notification
)
{
constructor
(
store
,
grpc
,
db
,
notification
)
{
this
.
_store
=
store
;
this
.
_store
=
store
;
this
.
_grpc
=
grpc
;
this
.
_grpc
=
grpc
;
this
.
_info
=
info
;
this
.
_db
=
db
;
this
.
_db
=
db
;
this
.
_notification
=
notification
;
this
.
_notification
=
notification
;
}
}
...
@@ -64,7 +63,7 @@ class AtplAction {
...
@@ -64,7 +63,7 @@ class AtplAction {
*/
*/
async
updateNodeScores
()
{
async
updateNodeScores
()
{
try
{
try
{
await
this
.
_
set
Network
();
await
this
.
_
check
Network
();
const
scores
=
await
this
.
_readNodeScores
();
const
scores
=
await
this
.
_readNodeScores
();
await
this
.
_setNodeScores
(
scores
);
await
this
.
_setNodeScores
(
scores
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -72,8 +71,7 @@ class AtplAction {
...
@@ -72,8 +71,7 @@ class AtplAction {
}
}
}
}
async
_setNetwork
()
{
async
_checkNetwork
()
{
await
this
.
_info
.
getInfo
();
if
(
!
this
.
_store
.
network
)
{
if
(
!
this
.
_store
.
network
)
{
throw
new
Error
(
'Could not read network'
);
throw
new
Error
(
'Could not read network'
);
}
}
...
...
src/action/index-mobile.js
View file @
9946311f
...
@@ -63,7 +63,7 @@ export const auth = new AuthAction(
...
@@ -63,7 +63,7 @@ export const auth = new AuthAction(
LocalAuthentication
,
LocalAuthentication
,
Alert
Alert
);
);
export
const
autopilot
=
new
AtplAction
(
store
,
grpc
,
info
,
db
,
notify
);
export
const
autopilot
=
new
AtplAction
(
store
,
grpc
,
db
,
notify
);
payment
.
listenForUrlMobile
(
Linking
);
// enable incoming url handler
payment
.
listenForUrlMobile
(
Linking
);
// enable incoming url handler
...
...
src/action/index.js
View file @
9946311f
...
@@ -42,7 +42,7 @@ export const channel = new ChannelAction(store, grpc, nav, notify);
...
@@ -42,7 +42,7 @@ export const channel = new ChannelAction(store, grpc, nav, notify);
export
const
invoice
=
new
InvoiceAction
(
store
,
grpc
,
nav
,
notify
,
Clipboard
);
export
const
invoice
=
new
InvoiceAction
(
store
,
grpc
,
nav
,
notify
,
Clipboard
);
export
const
payment
=
new
PaymentAction
(
store
,
grpc
,
nav
,
notify
,
Clipboard
);
export
const
payment
=
new
PaymentAction
(
store
,
grpc
,
nav
,
notify
,
Clipboard
);
export
const
setting
=
new
SettingAction
(
store
,
wallet
,
db
,
ipc
);
export
const
setting
=
new
SettingAction
(
store
,
wallet
,
db
,
ipc
);
export
const
autopilot
=
new
AtplAction
(
store
,
grpc
,
info
,
db
,
notify
);
export
const
autopilot
=
new
AtplAction
(
store
,
grpc
,
db
,
notify
);
payment
.
listenForUrl
(
ipc
);
// enable incoming url handler
payment
.
listenForUrl
(
ipc
);
// enable incoming url handler
...
...
test/integration/action/action-integration.spec.js
View file @
9946311f
...
@@ -167,7 +167,7 @@ describe('Action Integration Tests', function() {
...
@@ -167,7 +167,7 @@ describe('Action Integration Tests', function() {
channels1
=
new
ChannelAction
(
store1
,
grpc1
,
nav1
,
notify1
);
channels1
=
new
ChannelAction
(
store1
,
grpc1
,
nav1
,
notify1
);
invoice1
=
new
InvoiceAction
(
store1
,
grpc1
,
nav1
,
notify1
);
invoice1
=
new
InvoiceAction
(
store1
,
grpc1
,
nav1
,
notify1
);
payments1
=
new
PaymentAction
(
store1
,
grpc1
,
nav1
,
notify1
);
payments1
=
new
PaymentAction
(
store1
,
grpc1
,
nav1
,
notify1
);
autopilot1
=
new
AtplAction
(
store1
,
grpc1
,
info1
,
db1
,
notify1
);
autopilot1
=
new
AtplAction
(
store1
,
grpc1
,
db1
,
notify1
);
db2
=
sinon
.
createStubInstance
(
AppStorage
);
db2
=
sinon
.
createStubInstance
(
AppStorage
);
nav2
=
sinon
.
createStubInstance
(
NavAction
);
nav2
=
sinon
.
createStubInstance
(
NavAction
);
...
@@ -180,7 +180,7 @@ describe('Action Integration Tests', function() {
...
@@ -180,7 +180,7 @@ describe('Action Integration Tests', function() {
channels2
=
new
ChannelAction
(
store2
,
grpc2
,
nav2
,
notify2
);
channels2
=
new
ChannelAction
(
store2
,
grpc2
,
nav2
,
notify2
);
invoice2
=
new
InvoiceAction
(
store2
,
grpc2
,
nav2
,
notify2
);
invoice2
=
new
InvoiceAction
(
store2
,
grpc2
,
nav2
,
notify2
);
payments2
=
new
PaymentAction
(
store2
,
grpc2
,
nav2
,
notify2
);
payments2
=
new
PaymentAction
(
store2
,
grpc2
,
nav2
,
notify2
);
autopilot2
=
new
AtplAction
(
store2
,
grpc2
,
info2
,
db2
,
notify2
);
autopilot2
=
new
AtplAction
(
store2
,
grpc2
,
db2
,
notify2
);
sandbox
.
stub
(
autopilot1
,
'updateNodeScores'
).
resolves
(
true
);
sandbox
.
stub
(
autopilot1
,
'updateNodeScores'
).
resolves
(
true
);
sandbox
.
stub
(
autopilot2
,
'updateNodeScores'
).
resolves
(
true
);
sandbox
.
stub
(
autopilot2
,
'updateNodeScores'
).
resolves
(
true
);
...
...
test/unit/action/autopilot.spec.js
View file @
9946311f
...
@@ -2,7 +2,6 @@ import { Store } from '../../../src/store';
...
@@ -2,7 +2,6 @@ import { Store } from '../../../src/store';
import
GrpcAction
from
'../../../src/action/grpc'
;
import
GrpcAction
from
'../../../src/action/grpc'
;
import
NotificationAction
from
'../../../src/action/notification'
;
import
NotificationAction
from
'../../../src/action/notification'
;
import
AppStorage
from
'../../../src/action/app-storage'
;
import
AppStorage
from
'../../../src/action/app-storage'
;
import
InfoAction
from
'../../../src/action/info'
;
import
AtplAction
from
'../../../src/action/autopilot'
;
import
AtplAction
from
'../../../src/action/autopilot'
;
import
*
as
logger
from
'../../../src/action/log'
;
import
*
as
logger
from
'../../../src/action/log'
;
import
nock
from
'nock'
;
import
nock
from
'nock'
;
...
@@ -13,7 +12,6 @@ describe('Action Autopilot Unit Test', () => {
...
@@ -13,7 +12,6 @@ describe('Action Autopilot Unit Test', () => {
let
db
;
let
db
;
let
grpc
;
let
grpc
;
let
notify
;
let
notify
;
let
info
;
let
autopilot
;
let
autopilot
;
let
sandbox
;
let
sandbox
;
...
@@ -25,8 +23,7 @@ describe('Action Autopilot Unit Test', () => {
...
@@ -25,8 +23,7 @@ describe('Action Autopilot Unit Test', () => {
grpc
=
sinon
.
createStubInstance
(
GrpcAction
);
grpc
=
sinon
.
createStubInstance
(
GrpcAction
);
db
=
sinon
.
createStubInstance
(
AppStorage
);
db
=
sinon
.
createStubInstance
(
AppStorage
);
notify
=
sinon
.
createStubInstance
(
NotificationAction
);
notify
=
sinon
.
createStubInstance
(
NotificationAction
);
info
=
sinon
.
createStubInstance
(
InfoAction
);
autopilot
=
new
AtplAction
(
store
,
grpc
,
db
,
notify
);
autopilot
=
new
AtplAction
(
store
,
grpc
,
info
,
db
,
notify
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -87,7 +84,6 @@ describe('Action Autopilot Unit Test', () => {
...
@@ -87,7 +84,6 @@ describe('Action Autopilot Unit Test', () => {
},
},
],
],
};
};
info
.
getInfo
.
resolves
();
store
.
network
=
'testnet'
;
store
.
network
=
'testnet'
;
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment