Skip to content

Commit 990db64

Browse files
committed
small changes, wordings comments and logs
1 parent cfb43f9 commit 990db64

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

internal/database/dbpebble/store.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func NewStore(db *pebble.DB) *Store {
5050
}
5151

5252
func (s *Store) collectAndWrite(block *database.DBBlock) error {
53+
// with current logic channel size is irrelevant as it's not being used
54+
// we need to untangle bacth collection and the channel length
55+
// then we can continue computations while
5356
s.batchSync.Lock()
5457
if s.dbBatch == nil {
5558
s.dbBatch = s.DB.NewBatch()
@@ -75,7 +78,7 @@ func (s *Store) collectAndWrite(block *database.DBBlock) error {
7578
s.dbBatch = s.DB.NewBatch()
7679
s.batchCounter = 0
7780
}
78-
err := attachBlcokToBatch(s.dbBatch, block)
81+
err := attachBlockToBatch(s.dbBatch, block)
7982
if err != nil {
8083
logging.L.Err(err).Msg("failed to attach to batch")
8184
return err
@@ -110,7 +113,7 @@ func (s *Store) commitBatch() error {
110113
return nil
111114
}
112115

113-
func attachBlcokToBatch(batch *pebble.Batch, block *database.DBBlock) error {
116+
func attachBlockToBatch(batch *pebble.Batch, block *database.DBBlock) error {
114117
blockHash := block.Hash[:]
115118
txs := block.Txs
116119
height := block.Height

internal/indexer/builder.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ func (b *Builder) SyncBlocks(
175175
logging.L.Info().
176176
Uint32("height", syncTip).
177177
Msgf("current indexed chain tip %d", syncTip)
178+
logging.L.Info().
179+
Int("backlog_chan_pull", len(b.newBlockChan)).
180+
Int("backlog_chan_db_writer", len(b.writerChan)).
181+
Msg("new_tick_report")
178182
case <-tickerReports:
179183
logging.L.Trace().
180184
Int("backlog_chan_pull", len(b.newBlockChan)).

internal/indexer/rest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type ChainInfo struct {
5959
func GetChainInfo() (*ChainInfo, error) {
6060
req, err := http.NewRequest(
6161
http.MethodGet,
62-
fmt.Sprintf("%s/rest/chaininfo.json", config.RpcEndpoint),
62+
fmt.Sprintf("%s/rest/chaininfo.json", config.RestEndpoint),
6363
nil,
6464
)
6565
if err != nil {
@@ -96,7 +96,7 @@ func GetChainInfo() (*ChainInfo, error) {
9696
func getBlockHashByHeight(height int64) (*chainhash.Hash, error) {
9797
req, err := http.NewRequest(
9898
http.MethodGet,
99-
fmt.Sprintf("%s/rest/blockhashbyheight/%d.bin", config.RpcEndpoint, height),
99+
fmt.Sprintf("%s/rest/blockhashbyheight/%d.bin", config.RestEndpoint, height),
100100
nil,
101101
)
102102
if err != nil {

0 commit comments

Comments
 (0)