blockchain: updated store docs/comments from review

This commit is contained in:
Emmanuel Odeke 2017-10-05 17:03:01 -06:00 committed by Ethan Buchman
parent 116a61beb1
commit 05f30b3e28
1 changed files with 4 additions and 4 deletions

View File

@ -35,8 +35,8 @@ type BlockStore struct {
height int64 height int64
} }
// NewBlockStore returns a new BlockStore with the given db, // NewBlockStore returns a new BlockStore with the given DB,
// initialized to the last committed height. // initialized to the last height that was committed to the DB.
func NewBlockStore(db dbm.DB) *BlockStore { func NewBlockStore(db dbm.DB) *BlockStore {
bsjson := LoadBlockStoreStateJSON(db) bsjson := LoadBlockStoreStateJSON(db)
return &BlockStore{ return &BlockStore{
@ -54,7 +54,7 @@ func (bs *BlockStore) Height() int64 {
// GetReader returns the value associated with the given key wrapped in an io.Reader. // GetReader returns the value associated with the given key wrapped in an io.Reader.
// If no value is found, it returns nil. // If no value is found, it returns nil.
// Its mainly for use with wire.ReadBinary. // It's mainly for use with wire.ReadBinary.
func (bs *BlockStore) GetReader(key []byte) io.Reader { func (bs *BlockStore) GetReader(key []byte) io.Reader {
bytez := bs.db.Get(key) bytez := bs.db.Get(key)
if bytez == nil { if bytez == nil {
@ -249,7 +249,7 @@ func (bsj BlockStoreStateJSON) Save(db dbm.DB) {
} }
// LoadBlockStoreStateJSON returns the BlockStoreStateJSON as loaded from disk. // LoadBlockStoreStateJSON returns the BlockStoreStateJSON as loaded from disk.
// If no BlockStoreStateJSON was previously persisted, it returns a zero value one. // If no BlockStoreStateJSON was previously persisted, it returns the zero value.
func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON { func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON {
bytes := db.Get(blockStoreKey) bytes := db.Get(blockStoreKey)
if bytes == nil { if bytes == nil {