Use only index lookup in getBlockHeader, trezor needs only tx hash

pull/1/head
Martin Boehm 2018-02-07 21:11:50 +01:00
parent 12876290e4
commit 92aa4f0c7f
1 changed files with 3 additions and 0 deletions

View File

@ -256,6 +256,7 @@ type resultGetBlockHeader struct {
func (s *SocketIoServer) getBlockHeader(height uint32, hash string) (res resultGetBlockHeader, err error) {
if hash == "" {
// trezor is only interested in hash
if height == 0 {
height, hash, err = s.db.GetBestBlock()
if err != nil {
@ -267,6 +268,8 @@ func (s *SocketIoServer) getBlockHeader(height uint32, hash string) (res resultG
return
}
}
res.Result.Hash = hash
return
}
bh, err := s.chain.GetBlockHeader(hash)
if err != nil {