Skip to content

Commit

Permalink
refactor(SPV-1095): apply pr comments suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dzolt-4chain committed Oct 7, 2024
1 parent 7c6e8b4 commit 9a42a63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/sync_merkleroots/sync_merkleroots.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (db *db) SaveMerkleRoots(syncedMerkleRoots []walletclient.MerkleRoot) error
return nil
}

func (db *db) GetLastEvaluatedKey() string {
func (db *db) GetLastMerkleRoot() string {
if len(db.MerkleRoots) == 0 {
return ""
}
Expand Down
6 changes: 3 additions & 3 deletions sync_merkleroots.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type MerkleRoot struct {

// MerkleRootsRepository is an interface responsible for saving synced merkleroots and getting last evaluat key from database
type MerkleRootsRepository interface {
// GetLastEvaluatedKey should return the merkle root with the heighest height from your storage or undefined if empty
GetLastEvaluatedKey() string
// GetLastMerkleRoot should return the merkle root with the heighest height from your storage or undefined if empty
GetLastMerkleRoot() string
// SaveMerkleRoots should store newly synced merkle roots into your storage;
// NOTE: items are ordered with ascending order by block height
SaveMerkleRoots(syncedMerkleRoots []MerkleRoot) error
Expand All @@ -52,7 +52,7 @@ func (wc *WalletClient) SyncMerkleRoots(ctx context.Context, repo MerkleRootsRep
defer cancel()
}

lastEvaluatedKey := repo.GetLastEvaluatedKey()
lastEvaluatedKey := repo.GetLastMerkleRoot()
requestPath := "merkleroots"
lastEvaluatedKeyQuery := ""
previousLastEvaluatedKey := lastEvaluatedKey
Expand Down

0 comments on commit 9a42a63

Please sign in to comment.