Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check blockchain watchdogs regularly #1808

Merged
merged 1 commit into from
May 17, 2021
Merged

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented May 17, 2021

We want to check secondary blockchain sources when we haven't received blocks in a while.
Thanks @engenegr and @btcontract for raising this.

Fixes #1803

We want to check secondary blockchain sources when we haven't received
blocks in a while.

Fixes #1803
@t-bast t-bast requested a review from pm47 May 17, 2021 07:41
@codecov-commenter
Copy link

Codecov Report

Merging #1808 (477dec7) into master (340fd29) will decrease coverage by 0.04%.
The diff coverage is 40.00%.

@@            Coverage Diff             @@
##           master    #1808      +/-   ##
==========================================
- Coverage   89.33%   89.29%   -0.05%     
==========================================
  Files         143      143              
  Lines       10932    10934       +2     
  Branches      481      467      -14     
==========================================
- Hits         9766     9763       -3     
- Misses       1166     1171       +5     
Impacted Files Coverage Δ
...lair/blockchain/watchdogs/BlockchainWatchdog.scala 57.69% <40.00%> (-4.22%) ⬇️
...clair/blockchain/bitcoind/rpc/BatchingClient.scala 86.36% <0.00%> (-13.64%) ⬇️
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 84.68% <0.00%> (-0.43%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 86.31% <0.00%> (-0.17%) ⬇️
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 92.65% <0.00%> (-0.13%) ⬇️
...main/scala/fr/acinq/eclair/router/Validation.scala 92.30% <0.00%> (+1.53%) ⬆️

Behaviors.receiveMessage {
case NoBlockReceivedSince(lastBlockCount) =>
context.self ! CheckLatestHeaders(lastBlockCount)
timers.startSingleTimer(NoBlockReceivedTimer, NoBlockReceivedSince(lastBlockCount), blockTimeout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc:

if a new timer with same key is started the previous is cancelled.

So timers.startSingleTimer effectively resets the timer. ✔️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's why I chose the overload with a key ;)

@t-bast t-bast merged commit 9c3ee59 into master May 17, 2021
@t-bast t-bast deleted the blockchain-watchdog-timer branch May 17, 2021 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BlockchainWatchdog doesn't work independently
3 participants