Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework
GetLatestBlockHeight
function of the Electrum client
So far, `GetLatestBlockHeight` function used `SubscribeHeaders` under the hood. That caused a memory leak because `GetLatestBlockHeight` was not interested in reading from the returned `headersChan` channel. Each call to `GetLatestBlockHeight` produced a new dangling goroutine blocked on a buffered channel holding one item Here we replace `SubscribeHeaders` with `SubscribeHeadersSingle` which does not create a goroutine supposed to handle future headers notifications. The `SubscribeHeadersSingle` just return the current chain tip and ignores further notifications coming from the Electrum server. See keep-network/go-electrum#5 for further reference.
- Loading branch information