Define dbFetch{Basic,Extended}Header()

This commit is contained in:
pedro martelletto 2017-02-01 09:50:36 +00:00 committed by Olaoluwa Osuntokun
parent 7673859108
commit b53c42f5dc

View file

@ -49,6 +49,20 @@ func dbFetchExtendedEntry(dbTx database.Tx, h *chainhash.Hash) ([]byte, error) {
return idx.Get(h[:]), nil return idx.Get(h[:]), nil
} }
// dbFetchBasicHeader() retrieves a block's basic filter header. A filter's
// absence is not considered an error.
func dbFetchBasicHeader(dbTx database.Tx, h *chainhash.Hash) ([]byte, error) {
idx := dbTx.Metadata().Bucket(cfBasicHeaderKey)
return idx.Get(h[:]), nil
}
// dbFetchExtendedHeader() retrieves a block's extended filter header.
// A filter's absence is not considered an error.
func dbFetchExtendedHeader(dbTx database.Tx, h*chainhash.Hash) ([]byte, error) {
idx := dbTx.Metadata().Bucket(cfExtendedHeaderKey)
return idx.Get(h[:]), nil
}
// dbStoreBasicEntry() stores a block's basic filter. // dbStoreBasicEntry() stores a block's basic filter.
func dbStoreBasicEntry(dbTx database.Tx, h *chainhash.Hash, f []byte) error { func dbStoreBasicEntry(dbTx database.Tx, h *chainhash.Hash, f []byte) error {
idx := dbTx.Metadata().Bucket(cfBasicIndexKey) idx := dbTx.Metadata().Bucket(cfBasicIndexKey)