Skip to content

Commit eeac351

Browse files
committed
bug fix
1 parent 8726af7 commit eeac351

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/server/api.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ func (h *ApiHandler) GetTweakIndexDataByHeight(c *gin.Context) {
219219

220220
var serveTweakData = []string{}
221221
for _, tweak := range tweakIndex.Data {
222-
common.DebugLogger.Printf("%x- %d", tweak.Tweak(), tweak.HighestValue())
223222
if tweak.HighestValue() < dustLimit {
224223
continue
225224
}
@@ -267,14 +266,19 @@ func (h *ApiHandler) GetSpentOutpointsIndex(c *gin.Context) {
267266
return
268267
}
269268
spentOutpointsIndex, err := dblevel.FetchByBlockHashSpentOutpointIndex(hInv.Hash)
270-
if err != nil {
269+
if err != nil && !errors.Is(err, dblevel.NoEntryErr{}) {
271270
common.ErrorLogger.Println(err)
272271
c.JSON(http.StatusInternalServerError, gin.H{
273-
"error": "could no get spentOutpointsIndex from db",
272+
"error": "could could not retrieve data from database",
274273
})
275274
return
276275
}
277276

277+
if err != nil && errors.Is(err, dblevel.NoEntryErr{}) {
278+
c.JSON(http.StatusOK, []string{})
279+
return
280+
}
281+
278282
var result struct {
279283
BlockHash string `json:"block_hash"`
280284
Data []string `json:"data"`

0 commit comments

Comments
 (0)