Skip to content

Use a pool of Electrum servers#500

Merged
sstone merged 2 commits intomasterfrom
electrum-multiclient
Mar 23, 2018
Merged

Use a pool of Electrum servers#500
sstone merged 2 commits intomasterfrom
electrum-multiclient

Conversation

@sstone
Copy link
Member

@sstone sstone commented Mar 21, 2018

Use the one with the longest chain as master against which requests are sent

@sstone sstone force-pushed the electrum-multiclient branch from c671216 to ae53738 Compare March 21, 2018 19:02
@pm47 pm47 changed the title [WIP] connect to multiple electrum servers Connect to multiple electrum servers Mar 23, 2018
@pm47 pm47 changed the title Connect to multiple electrum servers Use a pool of Electrum servers Mar 23, 2018
primary client is the one on the longest chain, when a secondary client
has a chain that is longer than master + 2 it becomes the new master.
this will allow us to move away from "dead" electrum servers that are not
up to date with the blockchain.

electrum client: add 'get header' method

electrum: maintain a chain of headers for each client

and switch to the one with the longest chain

electrum: handle case when received header connects to our first header

it can happen when we connect to a server and ask for the last N headers

electrum: automatic reconnection

when we lose connection to our master client, we consider that we are
disconnected.
when we lose connection to a secondary client, we try to find an address
that is not used and connect to it. If there is no such address we wait
a bit and try to reconnect to the failing client

electrum: check that incoming header proof of work is valid

electrum router: migrate to Akka's FSM

electrum: fix match error for `ready` message

add missing copyright headers

move Blockchain to electrum package

electrum: simplify router

electrum client: fix handling of dead subscribers

electrum: move blockchain validation into electrum client

client will now send `ready` notifications and subscriptions messages only when it has a valid and
long enough blockchain

pass execution context as argument

reworked `ElectrumRouter` following
3dc1c2b61c82debeaed8d0d92238c0b5ee5c49c8

renamed `ElectrumRouter` -> `ElectrumMultiClient`

reformat

`var` -> `val`
@sstone sstone force-pushed the electrum-multiclient branch from 0e0601e to 6168b49 Compare March 23, 2018 12:10
Copy link
Member

Choose a reason for hiding this comment

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

why change 15s -> 30s

Copy link
Member

Choose a reason for hiding this comment

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

FIXME

statusListeners.map(_ ! ElectrumDisconnected)
context.system.eventStream.publish(ElectrumDisconnected)
context become disconnected
versionTrigger.cancel()
Copy link
Member

@pm47 pm47 Mar 23, 2018

Choose a reason for hiding this comment

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

Why cancel the task only in that case? Why not call versionTrigger.cancel() from e.g. aroundPostStop?

@sstone sstone force-pushed the electrum-multiclient branch from dbef3c9 to c18447e Compare March 23, 2018 18:37
@sstone sstone force-pushed the electrum-multiclient branch from c18447e to 575d647 Compare March 23, 2018 18:53
@sstone sstone merged commit fff6696 into master Mar 23, 2018
@sstone sstone deleted the electrum-multiclient branch March 26, 2018 13:38
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.

2 participants