diff --git a/common/common.go b/common/common.go index e7a3d04..90c495d 100644 --- a/common/common.go +++ b/common/common.go @@ -253,7 +253,7 @@ func GetBlock(cache *BlockCache, height int) (*walletrpc.CompactBlock, error) { } // GetBlockRange returns a sequence of consecutive blocks in the given range. -func GetBlockRange(cache *BlockCache, blockOut chan<- walletrpc.CompactBlock, errOut chan<- error, start, end int) { +func GetBlockRange(cache *BlockCache, blockOut chan<- *walletrpc.CompactBlock, errOut chan<- error, start, end int) { // Go over [start, end] inclusive for i := start; i <= end; i++ { block, err := GetBlock(cache, i) @@ -261,7 +261,7 @@ func GetBlockRange(cache *BlockCache, blockOut chan<- walletrpc.CompactBlock, er errOut <- err return } - blockOut <- *block + blockOut <- block } errOut <- nil } diff --git a/common/common_test.go b/common/common_test.go index 09f3b63..7257b2b 100644 --- a/common/common_test.go +++ b/common/common_test.go @@ -282,7 +282,7 @@ func TestGetBlockRange(t *testing.T) { RawRequest = getblockStub os.RemoveAll(unitTestPath) testcache := NewBlockCache(unitTestPath, unitTestChain, 380640, true) - blockChan := make(chan walletrpc.CompactBlock) + blockChan := make(chan *walletrpc.CompactBlock) errChan := make(chan error) go GetBlockRange(testcache, blockChan, errChan, 380640, 380642) diff --git a/frontend/service.go b/frontend/service.go index eb86345..aa14375 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -129,7 +129,7 @@ func (s *LwdStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*wal // (as also returned by GetBlock) from the block height 'start' to height // 'end' inclusively. func (s *LwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.CompactTxStreamer_GetBlockRangeServer) error { - blockChan := make(chan walletrpc.CompactBlock) + blockChan := make(chan *walletrpc.CompactBlock) errChan := make(chan error) go common.GetBlockRange(s.cache, blockChan, errChan, int(span.Start.Height), int(span.End.Height)) @@ -140,7 +140,7 @@ func (s *LwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.C // this will also catch context.DeadlineExceeded from the timeout return err case cBlock := <-blockChan: - err := resp.Send(&cBlock) + err := resp.Send(cBlock) if err != nil { return err }