Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/action/autopilot.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ class AtplAction {
* @return {Promise<undefined>}
*/
async toggle() {
const success = await this._setStatus(!this._store.settings.autopilot);
const newState = !this._store.settings.autopilot;
const success = await this._setStatus(newState);
if (success) {
this._store.settings.autopilot = !this._store.settings.autopilot;
this._store.settings.autopilot = newState;
this._db.save();
}
}
Expand Down
15 changes: 13 additions & 2 deletions src/action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ when(
* lnd node all balances, channels and transactions are fetched.
*/
when(
() => store.lndReady && store.autopilotReady,
() => store.lndReady,
() => {
autopilot.init();
wallet.pollBalances();
wallet.pollExchangeRate();
channel.pollChannels();
Expand All @@ -101,3 +100,15 @@ when(
info.pollInfo();
}
);

/**
* Initialize autopilot after syncing is finished and the grpc client
* is ready
*/
when(
() => store.syncedToChain && store.autopilotReady,
async () => {
await nap();
autopilot.init();
}
);