mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
common: fix up BOLT 3 references.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
0dc406c07a
commit
dba756ef38
@@ -25,25 +25,24 @@ static inline u64 commit_tx_base_fee(u32 feerate_per_kw,
|
||||
|
||||
/* BOLT #3:
|
||||
*
|
||||
* The base fee for a commitment transaction MUST BE
|
||||
* calculated to match:
|
||||
*
|
||||
* 1. Start with `weight` = 724.
|
||||
* The base fee for a commitment transaction:
|
||||
* - MUST be calculated to match:
|
||||
* 1. Start with `weight` = 724.
|
||||
*/
|
||||
weight = 724;
|
||||
|
||||
/* BOLT #3:
|
||||
*
|
||||
* 2. For each committed HTLC, if that output is not trimmed
|
||||
* as specified in [Trimmed Outputs](#trimmed-outputs), add
|
||||
* 172 to `weight`.
|
||||
* 2. For each committed HTLC, if that output is not trimmed as
|
||||
* specified in [Trimmed Outputs](#trimmed-outputs), add 172
|
||||
* to `weight`.
|
||||
*/
|
||||
weight += 172 * num_untrimmed_htlcs;
|
||||
|
||||
/* BOLT #3:
|
||||
*
|
||||
* 3. Multiply `feerate_per_kw` by `weight`, divide by 1000
|
||||
* (rounding down).
|
||||
* 3. Multiply `feerate_per_kw` by `weight`, divide by 1000 (rounding
|
||||
* down).
|
||||
*/
|
||||
return feerate_per_kw * weight / 1000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user