Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #129 from binance-chain/indexlag
Browse files Browse the repository at this point in the history
[R4R] fix tx indexer lag behind block
  • Loading branch information
HaoyangLiu authored Oct 30, 2019
2 parents 84d54d6 + 99b6bae commit b6d434b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
### IMPROVEMENTS:

### BUG FIXES:
- [index] [\#129](https://github.com/binance-chain/bnc-tendermint/pull/129) fix tx indexer lag behind block

2 changes: 1 addition & 1 deletion state/blockindex/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ func (bki *BlockIndex) Index(header *types.Header) error {
if err != nil {
return err
}
bki.store.Set(hash, rawBytes)
bki.store.SetSync(hash, rawBytes)
return nil
}
2 changes: 1 addition & 1 deletion state/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (ih *IndexHub) SetIndexedHeight(h int64) {
if err != nil {
ih.Logger.Error("failed to MarshalBinaryBare for indexed height", "error", err, "height", h)
} else {
ih.stateDB.Set(IndexHeightKey, rawHeight)
ih.stateDB.SetSync(IndexHeightKey, rawHeight)
}
}

Expand Down
4 changes: 2 additions & 2 deletions state/txindex/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (txi *TxIndex) AddBatch(b *txindex.Batch) error {
storeBatch.Set(hash, rawBytes)
}

storeBatch.Write()
storeBatch.WriteSync()
return nil
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func (txi *TxIndex) Index(result *types.TxResult) error {
}
b.Set(hash, rawBytes)

b.Write()
b.WriteSync()
return nil
}

Expand Down

0 comments on commit b6d434b

Please sign in to comment.