Skip to content

Commit 1cef4c3

Browse files
tankyleoTheBlueMatt
andcommitted
Use SINGLE|ACP sighash on signatures from peer in 0FC channels
Co-authored-by: Matt Corallo <[email protected]>
1 parent c944b24 commit 1cef4c3

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

lightning/src/ln/chan_utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,9 @@ pub fn build_htlc_input_witness(
869869
local_sig: &Signature, remote_sig: &Signature, preimage: &Option<PaymentPreimage>,
870870
redeem_script: &Script, channel_type_features: &ChannelTypeFeatures,
871871
) -> Witness {
872-
let remote_sighash_type = if channel_type_features.supports_anchors_zero_fee_htlc_tx() {
872+
let remote_sighash_type = if channel_type_features.supports_anchors_zero_fee_htlc_tx()
873+
|| channel_type_features.supports_anchor_zero_fee_commitments()
874+
{
873875
EcdsaSighashType::SinglePlusAnyoneCanPay
874876
} else {
875877
EcdsaSighashType::All

lightning/src/ln/channel.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4671,7 +4671,9 @@ where
46714671

46724672
let htlc_redeemscript =
46734673
chan_utils::get_htlc_redeemscript(&htlc, funding.get_channel_type(), &holder_keys);
4674-
let htlc_sighashtype = if funding.get_channel_type().supports_anchors_zero_fee_htlc_tx()
4674+
let channel_type = funding.get_channel_type();
4675+
let htlc_sighashtype = if channel_type.supports_anchors_zero_fee_htlc_tx()
4676+
|| channel_type.supports_anchor_zero_fee_commitments()
46754677
{
46764678
EcdsaSighashType::SinglePlusAnyoneCanPay
46774679
} else {

lightning/src/sign/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,9 @@ impl EcdsaChannelSigner for InMemorySigner {
14721472
&keys.revocation_key,
14731473
);
14741474
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc, chan_type, &keys);
1475-
let htlc_sighashtype = if chan_type.supports_anchors_zero_fee_htlc_tx() {
1475+
let htlc_sighashtype = if chan_type.supports_anchors_zero_fee_htlc_tx()
1476+
|| chan_type.supports_anchor_zero_fee_commitments()
1477+
{
14761478
EcdsaSighashType::SinglePlusAnyoneCanPay
14771479
} else {
14781480
EcdsaSighashType::All

lightning/src/util/test_channel_signer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ impl EcdsaChannelSigner for TestChannelSigner {
386386
let channel_parameters =
387387
&htlc_descriptor.channel_derivation_parameters.transaction_parameters;
388388
let channel_type_features = &channel_parameters.channel_type_features;
389-
let sighash_type = if channel_type_features.supports_anchors_zero_fee_htlc_tx() {
389+
let sighash_type = if channel_type_features.supports_anchors_zero_fee_htlc_tx()
390+
|| channel_type_features.supports_anchor_zero_fee_commitments()
391+
{
390392
EcdsaSighashType::SinglePlusAnyoneCanPay
391393
} else {
392394
EcdsaSighashType::All

0 commit comments

Comments
 (0)