Open crustywhale opened 6 days ago
I suspect the services (stacks-node and/or stacks-blockchain-api) are not ready for N second after boot, and that the broadcast is succeeding after that period of time rather than number of retries.
The rosetta /construction/submit
endpoint is essentially a wrapper around the stacks-core POST /v2/transactions
endpoint. It can only succeed once the stack-core RPC endpoints are responsive.
The API and postgres typically don't take long to start (maybe a few seconds?), so I'm assuming stacks-core isn't yet ready.
Here's a few things you can try:
Specify the env var SKIP_STACKS_CHAIN_ID_CHECK=1
in the API. This instructs the API to skip the startup validation request to the stacks-node at http://$STACKS_CORE_RPC_HOST:$STACKS_CORE_RPC_PORT
. This can shave off up 2.5 seconds from the API http server init time (if we assume the stacks-node is ready immediately just after the first API validation request).
Determine how long stacks-node takes to be ready by polling http://$STACKS_CORE_RPC_HOST:$STACKS_CORE_RPC_PORT/v2/pox
. This is the earliest possible time the Rosetta submit endpoint can work.
Node: 3.0.0.0.2 API: 8.2.2
After starting or restarting a stacks node and stacks api, the first 1 or 2 attempts to use the /construction/submit endpoint to broadcast a transaction will fail (timeout). By the third or fourth attempt it will start working, and once it does the problem will not reappear again until the stacks node and stacks API are restarted.