Skip to content

Commit b68efb9

Browse files
committed
f - drop SpliceOut::value
1 parent 2b57d4c commit b68efb9

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

lightning/src/ln/channel.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10696,19 +10696,6 @@ where
1069610696
),
1069710697
});
1069810698
}
10699-
10700-
let value_removed: Amount =
10701-
contribution.outputs().iter().map(|txout| txout.value).sum();
10702-
let negated_value_removed = -value_removed.to_signed().unwrap_or(SignedAmount::MAX);
10703-
if negated_value_removed != our_funding_contribution {
10704-
return Err(APIError::APIMisuseError {
10705-
err: format!(
10706-
"Channel {} cannot be spliced out; unexpected txout amounts: {}",
10707-
self.context.channel_id(),
10708-
value_removed,
10709-
),
10710-
});
10711-
}
1071210699
} else {
1071310700
// Note: post-splice channel value is not yet known at this point, counterparty contribution is not known
1071410701
// (Cannot test for miminum required post-splice channel value)

lightning/src/ln/channelmanager.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,10 @@ pub enum SpliceContribution {
216216
/// generated using `SignerProvider::get_destination_script`.
217217
change_script: Option<ScriptBuf>,
218218
},
219-
/// When only outputs are contributed to then funding transaction.
219+
/// When funds are removed from a channel.
220220
SpliceOut {
221-
/// The amount to remove from the channel.
222-
value: Amount,
223-
/// The outputs used for removing the amount. The total value of all outputs must equal
224-
/// [`SpliceOut::value`].
221+
/// The outputs to include in the splice's funding transaction. The total value of all
222+
/// outputs will be the amount that is removed.
225223
outputs: Vec<TxOut>,
226224
},
227225
}
@@ -233,8 +231,14 @@ impl SpliceContribution {
233231
SpliceContribution::SpliceIn { value, .. } => {
234232
value.to_signed().unwrap_or(SignedAmount::MAX)
235233
},
236-
SpliceContribution::SpliceOut { value, .. } => {
237-
value.to_signed().map(|value| -value).unwrap_or(SignedAmount::MIN)
234+
SpliceContribution::SpliceOut { outputs } => {
235+
let value_removed = outputs
236+
.iter()
237+
.map(|txout| txout.value)
238+
.sum::<Amount>()
239+
.to_signed()
240+
.unwrap_or(SignedAmount::MAX);
241+
-value_removed
238242
},
239243
}
240244
}
@@ -249,7 +253,7 @@ impl SpliceContribution {
249253
pub(super) fn outputs(&self) -> &[TxOut] {
250254
match self {
251255
SpliceContribution::SpliceIn { .. } => &[],
252-
SpliceContribution::SpliceOut { outputs, .. } => &outputs[..],
256+
SpliceContribution::SpliceOut { outputs } => &outputs[..],
253257
}
254258
}
255259

@@ -258,7 +262,7 @@ impl SpliceContribution {
258262
SpliceContribution::SpliceIn { inputs, change_script, .. } => {
259263
(inputs, vec![], change_script)
260264
},
261-
SpliceContribution::SpliceOut { outputs, .. } => (vec![], outputs, None),
265+
SpliceContribution::SpliceOut { outputs } => (vec![], outputs, None),
262266
}
263267
}
264268
}

0 commit comments

Comments
 (0)