Skip to content

Commit

Permalink
Remove blockstream server
Browse files Browse the repository at this point in the history
The blockstream's electrums servers seems very unstable and causes a lot
of noise in the logs, even after our optimizations we did in
ba416ce.

Closes: #3612
  • Loading branch information
nkuba committed Jun 8, 2023
1 parent 127429e commit a9ca4a2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
1 change: 0 additions & 1 deletion config/_electrum_urls/mainnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
wss://electrumx-server.tbtc.network:8443
wss://electrum.boar.network:2083
wss://bitcoin.threshold.p2p.org:50004
ssl://electrum.blockstream.info:50002
2 changes: 1 addition & 1 deletion config/_electrum_urls/testnet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
wss://electrumx-server.test.tbtc.network:8443
ssl://electrum.blockstream.info:60002

16 changes: 0 additions & 16 deletions config/electrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ import (
"fmt"
"math/rand"
"strings"
"time"

"github.com/keep-network/keep-core/pkg/bitcoin"
)

//go:embed _electrum_urls/*
var electrumURLs embed.FS

// Keep Alive Interval value used for Blockstream's electrum connections.
// This value is used only if a Blockstream's server is randomly selected from
// the list of embedded Electrum servers. It does not apply if a Blockstream's
// server connection is explicitly set in the client's configuration.
var blockstreamKeepAliveInterval = 55 * time.Second

// readElectrumUrls reads Electrum URLs from an embedded file for the
// given Bitcoin network.
func readElectrumUrls(network bitcoin.Network) (
Expand Down Expand Up @@ -78,14 +71,5 @@ func (c *Config) resolveElectrum(rng *rand.Rand) error {
// and we don't want to override them.
c.Bitcoin.Electrum.URL = selectedURL

// Blockstream's servers timeout session after 60 seconds of inactivity which
// is much shorter than expected 600 seconds. To workaround connection drops
// and logs pollution with warning we reduce the KeepAliveInterval for the
// Blockstream's servers to less than 60 seconds.
if c.Bitcoin.Electrum.KeepAliveInterval == 0 &&
strings.Contains(selectedURL, "electrum.blockstream.info") {
c.Bitcoin.Electrum.KeepAliveInterval = blockstreamKeepAliveInterval
}

return nil
}

0 comments on commit a9ca4a2

Please sign in to comment.