The SubscribeHeadersSingle function subscribes to receive the header of the current blockchain tip. Unlike SubscribeHeaders, this function only returns the tip and does not listen for new block headers.
Worth noting that this action still creates a new subscription in the Electrum server. The protocol does neither support a single-shot request for the current blockchain tip nor subscription cancellation. Although this limitation causes a slight resource overhead on the client, it does not cause a memory leak like the SubscribeHeaders method which spawns a goroutine that may hang on the channel if the caller is no longer pulling from it.
Refs: https://github.com/keep-network/keep-core/issues/3739
The
SubscribeHeadersSingle
function subscribes to receive the header of the current blockchain tip. UnlikeSubscribeHeaders
, this function only returns the tip and does not listen for new block headers.Worth noting that this action still creates a new subscription in the Electrum server. The protocol does neither support a single-shot request for the current blockchain tip nor subscription cancellation. Although this limitation causes a slight resource overhead on the client, it does not cause a memory leak like the
SubscribeHeaders
method which spawns a goroutine that may hang on the channel if the caller is no longer pulling from it.