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

Blockchain watchdogs use unique actor name #1667

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Jan 7, 2021

Actor names cannot conflict.

Even though blockchain watchdog actors stop themselves after fetching block data, when blocks are found in a short interval, we may end up with multiple actors of the same type simultaneously alive, so we need them to have unique names.

The blockcount isn't sufficient to make their names unique because forks can happen.

Fixes #1665

Actor names cannot conflict.

Even though blockchain watchdog actors stop themselves after fetching block
data, when blocks are found in a short interval, we may end up with multiple
actors of the same type simultaneously alive, so we need them to have
unique names.

The blockcount isn't sufficient to make their names unique because forks
can happen.

Fixes #1665
@t-bast t-bast requested a review from pm47 January 7, 2021 14:36
@codecov-io
Copy link

Codecov Report

Merging #1667 (261d3a3) into master (b477d17) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1667      +/-   ##
==========================================
+ Coverage   85.94%   85.99%   +0.04%     
==========================================
  Files         151      151              
  Lines       11471    11472       +1     
  Branches      505      505              
==========================================
+ Hits         9859     9865       +6     
+ Misses       1612     1607       -5     
Impacted Files Coverage Δ
...lair/blockchain/watchdogs/BlockchainWatchdog.scala 61.90% <100.00%> (+1.90%) ⬆️
...cala/fr/acinq/eclair/payment/relay/NodeRelay.scala 93.70% <0.00%> (-1.58%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 86.06% <0.00%> (+0.08%) ⬆️
...nq/eclair/blockchain/electrum/ElectrumClient.scala 74.26% <0.00%> (+0.73%) ⬆️
...q/eclair/blockchain/electrum/ElectrumWatcher.scala 77.77% <0.00%> (+3.17%) ⬆️

context.spawn(ExplorerApi(chainHash, blockCount, ExplorerApi.BlockstreamExplorer()), "blockstream") ! ExplorerApi.CheckLatestHeaders(context.self)
context.spawn(ExplorerApi(chainHash, blockCount, ExplorerApi.BlockcypherExplorer()), "blockcypher") ! ExplorerApi.CheckLatestHeaders(context.self)
context.spawn(ExplorerApi(chainHash, blockCount, ExplorerApi.MempoolSpaceExplorer()), "mempool.space") ! ExplorerApi.CheckLatestHeaders(context.self)
val id = UUID.randomUUID()
Copy link
Member

Choose a reason for hiding this comment

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

A thread-safe counter (AtomicInteger) could also have been used.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, but it's stateful and needs locks :)

@t-bast t-bast merged commit d40b321 into master Jan 19, 2021
@t-bast t-bast deleted the blockchain-watchdog-unique-names branch January 19, 2021 14:50
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.

Blockchain Watchdog : duplicate actor name
3 participants