MCPcopy Create free account
hub / github.com/ElementsProject/lightning / min_rbf_bump

Function min_rbf_bump

onchaind/onchaind.c:835–855  ·  view source on GitHub ↗

min_rbf_bump * * @brief computes the minimum RBF bump required by * BIP125, given an index. * * @desc BIP125 requires that an replacement transaction * pay, not just the fee of the evicted transactions, * but also the minimum relay fee for itself. * This function assumes that previous RBF attempts * paid exactly the return value for that attempt, on * top of the initial transaction fee.

Source from the content-addressed store, hash-verified

833 * @return the suggested total fee.
834 */
835static struct amount_sat min_rbf_bump(size_t weight,
836 size_t index)
837{
838 struct amount_sat min_relay_fee;
839 struct amount_sat min_rbf_bump;
840
841 /* Compute the minimum relay fee for a transaction of the given
842 * weight. */
843 min_relay_fee = amount_tx_fee(min_relay_feerate, weight);
844
845 /* For every RBF attempt, we add the min-relay-fee.
846 * Or in other words, we multiply the min-relay-fee by the
847 * index number of the attempt.
848 */
849 if (mul_overflows_u64(index, min_relay_fee.satoshis)) /* Raw: multiplication. */
850 min_rbf_bump = AMOUNT_SAT(UINT64_MAX);
851 else
852 min_rbf_bump.satoshis = index * min_relay_fee.satoshis; /* Raw: multiplication. */
853
854 return min_rbf_bump;
855}
856
857/** compute_penalty_output_amount
858 *

Callers 1

Calls 2

mul_overflows_u64Function · 0.85
amount_tx_feeFunction · 0.50

Tested by

no test coverage detected