Skip to content

Commit

Permalink
fix prev
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgnoah committed Dec 14, 2023
1 parent 0b18a59 commit 84b9624
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rpc/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,13 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
//prevBlkId, success := j.idsByHeight.Get(firstBlock - 1)

Prev := BlockInfo{}
if firstBlock > 0 {
if firstBlock > 1 {
// j.idsByHeight.Descend(firstBlock, func(heightKey uint64, id ids.ID) bool {

// prevBlkId = id
// return false
// })
prevBlkId, success := j.idsByHeight.Get(firstBlock)
prevBlkId, success := j.idsByHeight.Get(firstBlock - 1)

if success {
blk, found := j.headers.Get(prevBlkId.String())
Expand Down Expand Up @@ -574,8 +574,8 @@ func (j *JSONRPCServer) GetBlockHeadersByStart(req *http.Request, args *GetBlock
})

Prev := BlockInfo{}
if firstBlock > 0 {
prevBlkId, success := j.idsByHeight.Get(firstBlock)
if firstBlock > 1 {
prevBlkId, success := j.idsByHeight.Get(firstBlock - 1)

if success {
blk, found := j.headers.Get(prevBlkId.String())
Expand Down

0 comments on commit 84b9624

Please sign in to comment.