+ if err := block.UnmarshalText(binaryBlockTxs); err != nil {
+ return nil, err
+ }
+ return block.Transactions, nil
+}
+
+// GetBlockHashesByHeight return block hashes by given height
+func GetBlockHashesByHeight(db dbm.DB, height uint64) ([]*bc.Hash, error) {
+ binaryHashes := db.Get(calcBlockHashesPrefix(height))
+ if binaryHashes == nil {
+ return []*bc.Hash{}, nil
+ }
+
+ hashes := []*bc.Hash{}
+ if err := json.Unmarshal(binaryHashes, &hashes); err != nil {
+ return nil, err
+ }
+ return hashes, nil
+}
+
+// GetMainChainHash return BlockHash by given height
+func GetMainChainHash(db dbm.DB, height uint64) (*bc.Hash, error) {
+ binaryHash := db.Get(calcMainChainIndexPrefix(height))
+ if binaryHash == nil {
+ return nil, fmt.Errorf("There are no BlockHash with given height %d", height)
+ }
+
+ hash := &bc.Hash{}
+ if err := hash.UnmarshalText(binaryHash); err != nil {
+ return nil, err
+ }
+ return hash, nil
+}
+
+// GetVoteResult return the vote result by given sequence
+func GetVoteResult(db dbm.DB, seq uint64) (*state.VoteResult, error) {
+ data := db.Get(calcVoteResultKey(seq))
+ if data == nil {
+ return nil, protocol.ErrNotFoundVoteResult
+ }
+
+ voteResult := new(state.VoteResult)
+ if err := json.Unmarshal(data, voteResult); err != nil {
+ return nil, errors.Wrap(err, "unmarshaling vote result")
+ }
+ return voteResult, nil