common: fix up BOLT 3 references.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-06-17 19:41:53 +09:30
committed by Christian Decker
parent 0dc406c07a
commit dba756ef38
8 changed files with 79 additions and 74 deletions

View File

@@ -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;
}