Caravan Documentation
    Preparing search index...

    Function isCPFPFeeSatisfied

    • Determines if the combined fee rate of a parent and child transaction meets or exceeds the target fee rate for a Child-Pays-for-Parent (CPFP) transaction.

      This function calculates the combined fee rate of a parent transaction and its child (CPFP) transaction, then compares it to the target fee rate. It's used to ensure that the CPFP transaction provides sufficient fee incentive for miners to include both transactions in a block.

      The combined fee rate is calculated as: (parentFee + childFee) / (parentVsize + childVsize)

      Parameters

      Returns boolean

      True if the combined fee rate meets or exceeds the target fee rate, false otherwise.

      const txAnalyzer = new TransactionAnalyzer({...});
      const childTxTemplate = new BtcTransactionTemplate({...});
      const isSatisfied = isCPFPFeeSatisfied(txAnalyzer, childTxTemplate);
      console.log(isSatisfied); // true or false

      If any of the input parameters are negative.