From 91ae09926c20a94ba76264c4d444b4fa10f596ee Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 28 Jun 2017 11:50:03 +0930 Subject: [PATCH 1/2] BOLT 2: make it clear that we set fee, *then* eliminate outputs. You can't eliminate an output and also guarantee a certain fee, so we need to define exactly how to do this. Since the output is (presumably) dust, we might as well just discard it (effectively increasing the fee). This avoids the peer directly benefiting from the elimination as well. Signed-off-by: Rusty Russell --- 02-peer-protocol.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02-peer-protocol.md b/02-peer-protocol.md index f01362d6c..b7121a200 100644 --- a/02-peer-protocol.md +++ b/02-peer-protocol.md @@ -415,8 +415,8 @@ estimate of cost of inclusion in a block. The sender MUST set `signature` to the Bitcoin signature of the close transaction with the node responsible for paying the bitcoin fee -paying `fee_satoshis`, without populating any output which is below -its own `dust_limit_satoshis`. The sender MAY also eliminate its own +paying `fee_satoshis`, then removing any output which is below +its own `dust_limit_satoshis`. The sender MAY then also eliminate its own output from the mutual close transaction. The receiver MUST check `signature` is valid for either the close From b8d22e58423dd6ce9f784f2fed691cbeade4a501 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 30 Jun 2017 13:30:23 +0930 Subject: [PATCH 2/2] BOLT 2: closing fee is based on final commitment "base fee" not actual fee. The actual fee of the final tx may include eliminated outputs, which can differ between one side and the other (since they have different thresholds). Simplify this corner case by using our base fee calculation as the upper bound; it should be close enough we don't care, but disagreement here could cause negotiation breakdown. Signed-off-by: Rusty Russell --- 02-peer-protocol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02-peer-protocol.md b/02-peer-protocol.md index b7121a200..529597d88 100644 --- a/02-peer-protocol.md +++ b/02-peer-protocol.md @@ -408,7 +408,7 @@ Nodes SHOULD send a `closing_signed` message after `shutdown` has been received and no HTLCs remain in either commitment transaction. A sending node MUST set `fee_satoshis` lower than or equal to the -fee of the final commitment transaction. +base fee of the final commitment transaction as calculated in [BOLT #3](03-transactions.md#fee-calculation). The sender SHOULD set the initial `fee_satoshis` according to its estimate of cost of inclusion in a block.