Skip to content

Commit 3661773

Browse files
committed
fix api
1 parent 856dc78 commit 3661773

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ run:
219219

220220
.PHONY: docker
221221
docker:
222-
DOCKER_BUILDKIT=1 $(DOCKERCMD) build -t $(USER)/iotex-core:latest .
222+
DOCKER_BUILDKIT=1 $(DOCKERCMD) buildx build --platform linux/amd64 -t iotex$(USER)/iotex-core:latest --load .
223223

224224
.PHONY: docker-scan
225225
docker-scan: docker

api/coreservice.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ func newCoreService(
330330
}
331331

332332
func (core *coreService) WithHeight(height uint64) CoreServiceReaderWithHeight {
333+
// TODO (chenchen): remove this check after archive mode is fully supported
334+
// or check the height against tip
335+
if !core.archiveSupported {
336+
return core
337+
}
333338
return newCoreServiceWithHeight(core, height)
334339
}
335340

@@ -1696,7 +1701,7 @@ func (core *coreService) correctQueryRange(start, end uint64) (uint64, uint64, e
16961701
return 0, 0, errors.New("invalid start or end height")
16971702
}
16981703
if start > bfTipHeight {
1699-
return 0, 0, errors.New("start block > tip height")
1704+
return 0, 0, errors.Errorf("start block %d > tip height %d", start, bfTipHeight)
17001705
}
17011706
if end > bfTipHeight {
17021707
end = bfTipHeight

api/coreservice_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestLogsInRange(t *testing.T) {
126126
require.NoError(err)
127127

128128
_, _, err = svr.LogsInRange(logfilter.NewLogFilter(filter), from, to, uint64(0))
129-
expectedErr := errors.New("start block > tip height")
129+
expectedErr := errors.Errorf("start block %d > tip height %d", from, 4)
130130
require.Error(err)
131131
require.Equal(expectedErr.Error(), err.Error())
132132
})

chainservice/builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ func (builder *Builder) buildBlockDAO(forTest bool) error {
315315
}
316316
if path := cfg.Chain.PatchReceiptIndexPath; len(path) > 0 {
317317
dbConfig.DbPath = path
318+
dbConfig.ReadOnly = true
318319
opts = append(opts, blockdao.WithReceiptIndexer(blockdao.NewReceiptIndexer(db.NewBoltDB(dbConfig), cfg.Chain.PatchReceiptIndexEndHeight)))
319320
}
320321
}

0 commit comments

Comments
 (0)