decentralized-identity/sidetree

Sidetree transactions skipped when rpc for getRawTransaction fails

isaacJChen opened this issue · 1 comments

getValidWriterFromInputs fails when rpc calls timeout, which causes sidetree transactions to be skipped.

    try {
      const transaction = await this.bitcoinClient.getRawTransaction(transactionId);

      return transaction.outputs[outputIndexToFetch];
    } catch (e) {
      Logger.warn(`Error while trying to get outputIdx: ${outputIndexToFetch} from transaction: ${transactionId}. Error: ${SidetreeError.stringify(e)}`);
      return undefined;
    }
  }

The above function in SidetreeTransactionParser is called, and if timeout happens in rpc call, this will be the resulting log and causes the issue

Sending jRPC request: id: 3drsn3i3m86, method: getrawtransaction Request timeout (0) Retrying request (1) Request timeout (1) Retrying request (2) Request timeout (2) Retrying request (3) Max retries reached. Request failed. Valid sidetree data was found but no valid writer was found for transaction id: 31e0e0eb340dce3da9444cac71fdb64bc4ec87f20d8427889fd1d3afb34b2bff