Skip to content

Commit

Permalink
docker: Do not catchup if already initialized. (algorand#5756)
Browse files Browse the repository at this point in the history
  • Loading branch information
winder authored Sep 28, 2023
1 parent 157f59f commit 67275a6
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 240 deletions.
6 changes: 3 additions & 3 deletions cmd/goal/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var newNodeFullConfig bool
var watchMillisecond uint64
var abortCatchup bool
var fastCatchupForce bool
var initializeCatchup uint64
var minCatchupRounds uint64

const catchpointURL = "https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/%s/latest.catchpoint"

Expand Down Expand Up @@ -117,7 +117,7 @@ func init() {

catchupCmd.Flags().BoolVarP(&abortCatchup, "abort", "x", false, "Aborts the current catchup process")
catchupCmd.Flags().BoolVar(&fastCatchupForce, "force", false, "Forces fast catchup with implicit catchpoint to start without a consent prompt")
catchupCmd.Flags().Uint64VarP(&initializeCatchup, "initialize", "i", 0, "Catchup only if the catchpoint would advance the node by at least the specified number of rounds")
catchupCmd.Flags().Uint64VarP(&minCatchupRounds, "min", "m", 0, "Catchup only if the catchpoint would advance the node by the specified minimum number of rounds")

}

Expand Down Expand Up @@ -204,7 +204,7 @@ var catchupCmd = &cobra.Command{
}
}

resp, err := client.Catchup(catchpoint, initializeCatchup)
resp, err := client.Catchup(catchpoint, minCatchupRounds)
if err != nil {
reportErrorf(errorNodeStatus, err)
}
Expand Down
4 changes: 2 additions & 2 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2510,8 +2510,8 @@
"$ref": "#/parameters/catchpoint"
},
{
"name": "initialize",
"description": "Specify a number of blocks which the ledger must be advanced by in order to start the catchup. This is useful for simplifying tools which support fast catchup, they can run the catchup unconditionally and the node will skip the catchup if it is not needed.",
"name": "min",
"description": "Specify the minimum number of blocks which the ledger must be advanced by in order to start the catchup. This is useful for simplifying tools which support fast catchup, they can run the catchup unconditionally and the node will skip the catchup if it is not needed.",
"in": "query",
"type": "integer"
}
Expand Down
4 changes: 2 additions & 2 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4304,9 +4304,9 @@
"x-algorand-format": "Catchpoint String"
},
{
"description": "Specify a number of blocks which the ledger must be advanced by in order to start the catchup. This is useful for simplifying tools which support fast catchup, they can run the catchup unconditionally and the node will skip the catchup if it is not needed.",
"description": "Specify the minimum number of blocks which the ledger must be advanced by in order to start the catchup. This is useful for simplifying tools which support fast catchup, they can run the catchup unconditionally and the node will skip the catchup if it is not needed.",
"in": "query",
"name": "initialize",
"name": "min",
"schema": {
"type": "integer"
}
Expand Down
6 changes: 3 additions & 3 deletions daemon/algod/api/client/restClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ type accountInformationParams struct {
}

type catchupParams struct {
Initialize uint64 `url:"initialize"`
Min uint64 `url:"min"`
}

// PendingTransactionsByAddr returns all the pending transactions for an addr.
Expand Down Expand Up @@ -579,8 +579,8 @@ func (client RestClient) AbortCatchup(catchpointLabel string) (response model.Ca
}

// Catchup start catching up to the give catchpoint label
func (client RestClient) Catchup(catchpointLabel string, initializeRounds uint64) (response model.CatchpointStartResponse, err error) {
err = client.submitForm(&response, fmt.Sprintf("/v2/catchup/%s", catchpointLabel), catchupParams{Initialize: initializeRounds}, nil, "POST", false, true, false)
func (client RestClient) Catchup(catchpointLabel string, minRounds uint64) (response model.CatchpointStartResponse, err error) {
err = client.submitForm(&response, fmt.Sprintf("/v2/catchup/%s", catchpointLabel), catchupParams{Min: minRounds}, nil, "POST", false, true, false)
return
}

Expand Down
4 changes: 2 additions & 2 deletions daemon/algod/api/server/v2/generated/model/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 67275a6

Please sign in to comment.