feat: add network field to the go api#341
Merged
Merged
Conversation
Signed-off-by: sczembor <stanislaw.czembor@gmail.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the Bitcoin indexer Go client to include a network identifier in API calls, wires that configuration through the CLI, and bumps the btcindexer API dependency to a version that supports the new network field. Sequence diagram for btcindexer client initialization with networksequenceDiagram
actor Operator
participant RelayerCLI as RelayerCLI
participant Config as Config
participant BtcIndexerClient as BtcIndexerClient
Operator->>RelayerCLI: start bitcoin-spv
RelayerCLI->>Config: load Config
Config-->>RelayerCLI: Relayer.IndexerURL, Relayer.NetParams
alt IndexerURL not configured
RelayerCLI->>RelayerCLI: log BTC Indexer not configured
RelayerCLI-->>Operator: continue without indexer
else IndexerURL configured
RelayerCLI->>BtcIndexerClient: NewClient(IndexerURL, NetParams, rootLogger)
BtcIndexerClient-->>RelayerCLI: client with network field set
RelayerCLI-->>Operator: run with configured indexer client
end
Sequence diagram for preparePayload sending network to btcindexer APIsequenceDiagram
participant Relayer as Relayer
participant BtcIndexerClient as BtcIndexerClient
participant BtcIndexerAPI as BtcIndexerAPI
Relayer->>BtcIndexerClient: preparePayload(blocks)
loop for each IndexedBlock
BtcIndexerClient->>BtcIndexerClient: serialize block to blockBuffer
BtcIndexerClient->>BtcIndexerClient: create PutBlock
Note over BtcIndexerClient: PutBlock.Network = client.network
end
BtcIndexerClient-->>Relayer: []PutBlock with Network set
Relayer->>BtcIndexerAPI: PutBlocks([]PutBlock)
BtcIndexerAPI-->>Relayer: response based on Network and Height
Updated class diagram for btcindexer Client with network fieldclassDiagram
class Client {
- logger zerolog_Logger
- apiClient btcindexer_Client
- network string
+ NewClient(url string, network string, parentLogger zerolog_Logger) *Client
+ preparePayload(blocks []*types_IndexedBlock) (btcindexer_PutBlockRequest, error)
}
class zerolog_Logger
class btcindexer_Client
class types_IndexedBlock {
+ BlockHeight int64
+ Block interface
}
Client --> zerolog_Logger : uses
Client --> btcindexer_Client : wraps
Client --> types_IndexedBlock : prepares payload from
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
robert-zaremba
approved these changes
Nov 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.mdSummary by Sourcery
Add Bitcoin indexer client support for specifying the target network when sending blocks.
New Features:
Enhancements:
Build: