Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

algod:Stateproof server api #3888

Merged
merged 19 commits into from
May 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: using latest round as max round to look for the stateproof
  • Loading branch information
algonathan committed May 1, 2022
commit ec294ef49ea8abca47d3a62dbb749c06fa34bdab
10 changes: 2 additions & 8 deletions daemon/algod/api/server/v2/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ func (v2 *Handlers) TealCompile(ctx echo.Context) error {
}

var errNilLedger = errors.New("could not contact ledger")
var errNoStateProofInRange = errors.New("no state proof in range")
var errNoStateProofInRange = errors.New("no stateproof for that round")

// StateProof returns the state proof for a given round.
// (GET /v2/transaction/state-proof/{round})
Expand All @@ -1168,14 +1168,8 @@ func (v2 *Handlers) StateProof(ctx echo.Context, round uint64) error {
if basics.Round(round) > ledger.Latest() {
return notFound(ctx, errNoStateProofInRange, "round does not exist", v2.Log)
}
consensus, err := ledger.ConsensusParams(basics.Round(round))
if err != nil {
return internalError(ctx, err, fmt.Sprintf("could not retrieve consensus information for round (%d)", round), v2.Log)
}

lastCompCertLocation := round - (round % consensus.CompactCertRounds) + consensus.CompactCertRounds

txns, err := v2.Node.ListTxns(transactions.CompactCertSender, basics.Round(round), basics.Round(lastCompCertLocation))
txns, err := v2.Node.ListTxns(transactions.CompactCertSender, basics.Round(round), ledger.Latest())
if err != nil {
return internalError(ctx, err, errNilLedger.Error(), v2.Log)
}
Expand Down