Skip to content

Commit

Permalink
indexers: Use testable bucket for existsaddrindex.
Browse files Browse the repository at this point in the history
This modifies the functions in the exists address index to use the
internalBucket interface instead of directly taking a database.Bucket
interface.  This allows tests to mock the data the source and is
consistent with the address index.
  • Loading branch information
davecgh committed Sep 10, 2018
1 parent c5e3320 commit 830aa6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blockchain/indexers/existsaddrindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ func (idx *ExistsAddrIndex) Create(dbTx database.Tx) error {

// dbPutExistsAddr uses an existing database transaction to update or add a
// used address index to the database.
func dbPutExistsAddr(bucket database.Bucket, addrKey [addrKeySize]byte) error {
func dbPutExistsAddr(bucket internalBucket, addrKey [addrKeySize]byte) error {
return bucket.Put(addrKey[:], nil)
}

// existsAddress takes a bucket and key for an address and responds with
// whether or not the key exists in the database.
func (idx *ExistsAddrIndex) existsAddress(bucket database.Bucket, k [addrKeySize]byte) bool {
func (idx *ExistsAddrIndex) existsAddress(bucket internalBucket, k [addrKeySize]byte) bool {
if bucket.Get(k[:]) != nil {
return true
}
Expand Down

0 comments on commit 830aa6b

Please sign in to comment.