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.
| 833 | * @return the suggested total fee. |
| 834 | */ |
| 835 | static 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 | * |
no test coverage detected