@xo-cash/engine
    Preparing search index...

    Function updateUnspentOutputsForScriptHashInStore

    • Synchronizes the store of unspent outputs for a given script hash with the current state of the blockchain.

      This method performs the following:

      1. Retrieves the stored script hash data from the state.
      2. Fetches the current list of unspent outputs for the script hash from the state.
      3. Queries the blockchain for all unspent transaction outputs associated with the script hash.
      4. Adds any new unspent outputs found on the blockchain but missing from the state to the state.
      5. Removes any unspent outputs present in the state but no longer in the blockchain.

      Parameters

      • state: State

        The State instance to use for data operations.

      • scriptHash: string

        The script hash for which to update the stored unspent outputs.

      • fetchUnspentOutputsCallback: (scriptHash: string) => Promise<ScriptHashListUnspentResponse>

        Callback function to fetch unspent outputs from the blockchain.

      Returns Promise<void>

      If the script hash is not found in the state.