Skip to main content

await_tx_accepted_before_polling

Function await_tx_accepted_before_polling 

Source
async fn await_tx_accepted_before_polling(
    global_context: &DynGlobalClientContext,
    txid: TransactionId,
    blind_nonce: BlindNonce,
)
Expand description

Waits until the transaction txid is known to be accepted

Long-polling a peer for the outcome of an output never returns while its transaction is not accepted, and occupies one of the peer’s request slots on the client’s connection for as long as it waits. So output state machines must not start long-polling for a transaction that may never get accepted.

The client learns of the acceptance from the transaction’s submission state machine. Output state machines restored by recovery have none, so this also polls whether the federation has used blind_nonce, which it does exactly when it accepts a transaction issuing the output. That check answers immediately, and is repeated with a backoff of up to BLIND_NONCE_USED_CHECK_MAX_DELAY.

If the transaction gets rejected this never returns, and the state machine’s rejection transition fires instead.