diff --git a/ethdb/kv_remote.go b/ethdb/kv_remote.go index 02cff8ecc1356f148497a92e67dc359befe3914f..d7b43223ee495d2d83d11985e06203574eb5cf46 100644 --- a/ethdb/kv_remote.go +++ b/ethdb/kv_remote.go @@ -336,7 +336,7 @@ func (c *remoteCursor) Seek(seek []byte) ([]byte, []byte, error) { var err error if c.stream == nil { var streamCtx context.Context - streamCtx, c.streamCancelFn = context.WithCancel(context.Background()) // We create child context for the stream so we can cancel it to prevent leak + streamCtx, c.streamCancelFn = context.WithCancel(c.ctx) // We create child context for the stream so we can cancel it to prevent leak c.stream, err = c.tx.db.remoteKV.Seek(streamCtx) } @@ -430,7 +430,7 @@ func (c *remoteCursorDupSort) SeekBothRange(key, value []byte) ([]byte, []byte, var err error if c.stream == nil { var streamCtx context.Context - streamCtx, c.streamCancelFn = context.WithCancel(context.Background()) // We create child context for the stream so we can cancel it to prevent leak + streamCtx, c.streamCancelFn = context.WithCancel(c.ctx) // We create child context for the stream so we can cancel it to prevent leak c.stream, err = c.tx.db.remoteKV.Seek(streamCtx) if err != nil { return []byte{}, nil, err