Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgnoah committed Oct 30, 2023
1 parent 48df7cd commit 11d0e7b
Showing 1 changed file with 43 additions and 26 deletions.
69 changes: 43 additions & 26 deletions rpc/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,31 +350,27 @@ func (j *JSONRPCServer) GetBlockHeadersByHeight(req *http.Request, args *GetBloc
if err != nil {
return false
}
if blk.Hght == heightKey {
blocks = append(blocks, BlockInfo{
BlockId: id.String(),
Timestamp: blk.Tmstmp,
L1Head: l1Head.Uint64(),
})
}

// if blk.Hght == heightKey && blk.Tmstmp < endNumber {
// blocks = append(blocks, BlockInfo{
// BlockId: id,
// })
// }

// endNumber
// TODO do I want this as a timestamp
if blk.Tmstmp >= args.End {
tmp := blk.Tmstmp / 1000

if blk.Tmstmp > args.End {
Next = BlockInfo{
BlockId: id.String(),
Timestamp: blk.Tmstmp,
Timestamp: tmp,
L1Head: l1Head.Uint64(),
}
return false
}

if blk.Hght == heightKey {
tmp := blk.Tmstmp / 1000

blocks = append(blocks, BlockInfo{
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
})
}
return true
})

Expand Down Expand Up @@ -461,22 +457,43 @@ func (j *JSONRPCServer) GetBlockHeadersID(req *http.Request, args *GetBlockHeade
return false
}

if blk.Hght == heightKey {
blocks = append(blocks, BlockInfo{
BlockId: id.String(),
Timestamp: blk.Tmstmp,
L1Head: l1Head.Uint64(),
})
}
// if blk.Hght == heightKey {
// blocks = append(blocks, BlockInfo{
// BlockId: id.String(),
// Timestamp: blk.Tmstmp,
// L1Head: l1Head.Uint64(),
// })
// }

// if blk.Tmstmp > args.End {
// Next = BlockInfo{
// BlockId: id.String(),
// Timestamp: blk.Tmstmp,
// L1Head: l1Head.Uint64(),
// }
// return false
// }

if blk.Tmstmp >= args.End {
tmp := blk.Tmstmp / 1000

if blk.Tmstmp > args.End {
Next = BlockInfo{
BlockId: id.String(),
Timestamp: blk.Tmstmp,
Timestamp: tmp,
L1Head: l1Head.Uint64(),
}
return false
}

if blk.Hght == heightKey {
tmp := blk.Tmstmp / 1000

blocks = append(blocks, BlockInfo{
BlockId: id.String(),
Timestamp: tmp,
L1Head: l1Head.Uint64(),
})
}
return true
})

Expand Down

0 comments on commit 11d0e7b

Please sign in to comment.