From 21104b31ded5b95b3adfd63e1b752e61b3de09ac Mon Sep 17 00:00:00 2001 From: Nikita Neznaemov Date: Wed, 11 Oct 2023 14:10:26 +0300 Subject: [PATCH] bugfix/separate-observer-parsing --- observer/block_peer_common.go | 2 ++ observer/block_peer_common_concurrently.go | 2 ++ observer/block_peer_parsed.go | 2 ++ observer/block_peer_parsed_concurrently.go | 2 ++ 4 files changed, 8 insertions(+) diff --git a/observer/block_peer_common.go b/observer/block_peer_common.go index 237f650..1755b34 100644 --- a/observer/block_peer_common.go +++ b/observer/block_peer_common.go @@ -186,6 +186,8 @@ func (bp *BlockPeer) initChannels(ctx context.Context) { func (bp *BlockPeer) peerChannel(ctx context.Context, channel string) *blockPeerChannel { seekFrom := bp.seekFrom[channel] if seekFrom > 0 { + // it must be -1, because start position here is excluded from array + // https://github.com/s7techlab/hlf-sdk-go/blob/master/proto/seek.go#L15 seekFrom-- } diff --git a/observer/block_peer_common_concurrently.go b/observer/block_peer_common_concurrently.go index 945bf4d..a092f3c 100644 --- a/observer/block_peer_common_concurrently.go +++ b/observer/block_peer_common_concurrently.go @@ -66,6 +66,8 @@ func (bp *BlockPeer) initChannelsConcurrently(ctx context.Context, blocksByChann func (bp *BlockPeer) peerChannelConcurrently(ctx context.Context, channel string, blocksByChannels *BlocksByChannels) *blockPeerChannel { seekFrom := bp.seekFrom[channel] if seekFrom > 0 { + // it must be -1, because start position here is excluded from array + // https://github.com/s7techlab/hlf-sdk-go/blob/master/proto/seek.go#L15 seekFrom-- } diff --git a/observer/block_peer_parsed.go b/observer/block_peer_parsed.go index 9cd1523..db04164 100644 --- a/observer/block_peer_parsed.go +++ b/observer/block_peer_parsed.go @@ -149,6 +149,8 @@ func (pbp *ParsedBlockPeer) initParsedChannels(ctx context.Context) { func (pbp *ParsedBlockPeer) peerParsedChannel(ctx context.Context, channel string) *parsedBlockPeerChannel { seekFrom := pbp.blockPeer.seekFrom[channel] if seekFrom > 0 { + // it must be -1, because start position here is excluded from array + // https://github.com/s7techlab/hlf-sdk-go/blob/master/proto/seek.go#L15 seekFrom-- } diff --git a/observer/block_peer_parsed_concurrently.go b/observer/block_peer_parsed_concurrently.go index 2d236df..f3743a1 100644 --- a/observer/block_peer_parsed_concurrently.go +++ b/observer/block_peer_parsed_concurrently.go @@ -68,6 +68,8 @@ func (pbp *ParsedBlockPeer) initParsedChannelsConcurrently(ctx context.Context, func (pbp *ParsedBlockPeer) peerParsedChannelConcurrently(ctx context.Context, channel string, blocksByChannels *ParsedBlocksByChannels) *parsedBlockPeerChannel { seekFrom := pbp.blockPeer.seekFrom[channel] if seekFrom > 0 { + // it must be -1, because start position here is excluded from array + // https://github.com/s7techlab/hlf-sdk-go/blob/master/proto/seek.go#L15 seekFrom-- }