Browse Source

blockchain: updated store docs/comments from review

pull/677/head
Emmanuel Odeke 7 years ago
committed by Ethan Buchman
parent
commit
05f30b3e28
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      blockchain/store.go

+ 4
- 4
blockchain/store.go View File

@ -35,8 +35,8 @@ type BlockStore struct {
height int64 height int64
} }
// NewBlockStore returns a new BlockStore with the given db,
// initialized to the last committed height.
// NewBlockStore returns a new BlockStore with the given DB,
// 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 {


Loading…
Cancel
Save