@@ -426,7 +426,7 @@ struct LocalSignedTx {
426
426
pub ( crate ) enum InputMaterial {
427
427
Revoked {
428
428
per_commitment_point : PublicKey ,
429
- key : SecretKey ,
429
+ per_commitment_key : SecretKey ,
430
430
input_descriptor : InputDescriptors ,
431
431
amount : u64 ,
432
432
} ,
@@ -449,10 +449,10 @@ pub(crate) enum InputMaterial {
449
449
impl Writeable for InputMaterial {
450
450
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
451
451
match self {
452
- & InputMaterial :: Revoked { ref per_commitment_point, ref key , ref input_descriptor, ref amount} => {
452
+ & InputMaterial :: Revoked { ref per_commitment_point, ref per_commitment_key , ref input_descriptor, ref amount} => {
453
453
writer. write_all ( & [ 0 ; 1 ] ) ?;
454
454
per_commitment_point. write ( writer) ?;
455
- writer. write_all ( & key [ ..] ) ?;
455
+ writer. write_all ( & per_commitment_key [ ..] ) ?;
456
456
input_descriptor. write ( writer) ?;
457
457
writer. write_all ( & byte_utils:: be64_to_array ( * amount) ) ?;
458
458
} ,
@@ -483,12 +483,12 @@ impl Readable for InputMaterial {
483
483
let input_material = match <u8 as Readable >:: read ( reader) ? {
484
484
0 => {
485
485
let per_commitment_point = Readable :: read ( reader) ?;
486
- let key = Readable :: read ( reader) ?;
486
+ let per_commitment_key = Readable :: read ( reader) ?;
487
487
let input_descriptor = Readable :: read ( reader) ?;
488
488
let amount = Readable :: read ( reader) ?;
489
489
InputMaterial :: Revoked {
490
490
per_commitment_point,
491
- key ,
491
+ per_commitment_key ,
492
492
input_descriptor,
493
493
amount
494
494
}
@@ -1451,7 +1451,6 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1451
1451
let per_commitment_key = ignore_error ! ( SecretKey :: from_slice( & secret) ) ;
1452
1452
let per_commitment_point = PublicKey :: from_secret_key ( & self . secp_ctx , & per_commitment_key) ;
1453
1453
let revocation_pubkey = ignore_error ! ( chan_utils:: derive_public_revocation_key( & self . secp_ctx, & per_commitment_point, & self . keys. pubkeys( ) . revocation_basepoint) ) ;
1454
- let revocation_key = ignore_error ! ( chan_utils:: derive_private_revocation_key( & self . secp_ctx, & per_commitment_key, & self . keys. revocation_base_key( ) ) ) ;
1455
1454
let local_payment_key = ignore_error ! ( chan_utils:: derive_private_key( & self . secp_ctx, & per_commitment_point, & self . keys. payment_base_key( ) ) ) ;
1456
1455
let delayed_key = ignore_error ! ( chan_utils:: derive_public_key( & self . secp_ctx, & PublicKey :: from_secret_key( & self . secp_ctx, & per_commitment_key) , & self . their_delayed_payment_base_key) ) ;
1457
1456
@@ -1468,7 +1467,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1468
1467
// First, process non-htlc outputs (to_local & to_remote)
1469
1468
for ( idx, outp) in tx. output . iter ( ) . enumerate ( ) {
1470
1469
if outp. script_pubkey == revokeable_p2wsh {
1471
- let witness_data = InputMaterial :: Revoked { per_commitment_point, key : revocation_key , input_descriptor : InputDescriptors :: RevokedOutput , amount : outp. value } ;
1470
+ let witness_data = InputMaterial :: Revoked { per_commitment_point, per_commitment_key , input_descriptor : InputDescriptors :: RevokedOutput , amount : outp. value } ;
1472
1471
claimable_outpoints. push ( ClaimRequest { absolute_timelock : height + self . our_to_self_delay as u32 , aggregable : true , outpoint : BitcoinOutPoint { txid : commitment_txid, vout : idx as u32 } , witness_data} ) ;
1473
1472
}
1474
1473
}
@@ -1481,7 +1480,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1481
1480
tx. output [ transaction_output_index as usize ] . value != htlc. amount_msat / 1000 {
1482
1481
return ( claimable_outpoints, ( commitment_txid, watch_outputs) ) ; // Corrupted per_commitment_data, fuck this user
1483
1482
}
1484
- let witness_data = InputMaterial :: Revoked { per_commitment_point, key : revocation_key , input_descriptor : if htlc. offered { InputDescriptors :: RevokedOfferedHTLC } else { InputDescriptors :: RevokedReceivedHTLC } , amount : tx. output [ transaction_output_index as usize ] . value } ;
1483
+ let witness_data = InputMaterial :: Revoked { per_commitment_point, per_commitment_key , input_descriptor : if htlc. offered { InputDescriptors :: RevokedOfferedHTLC } else { InputDescriptors :: RevokedReceivedHTLC } , amount : tx. output [ transaction_output_index as usize ] . value } ;
1485
1484
claimable_outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable : true , outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1486
1485
}
1487
1486
}
@@ -1654,10 +1653,9 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1654
1653
let secret = if let Some ( secret) = self . get_secret ( commitment_number) { secret } else { return ( Vec :: new ( ) , None ) ; } ;
1655
1654
let per_commitment_key = ignore_error ! ( SecretKey :: from_slice( & secret) ) ;
1656
1655
let per_commitment_point = PublicKey :: from_secret_key ( & self . secp_ctx , & per_commitment_key) ;
1657
- let revocation_key = ignore_error ! ( chan_utils:: derive_private_revocation_key( & self . secp_ctx, & per_commitment_key, & self . keys. revocation_base_key( ) ) ) ;
1658
1656
1659
1657
log_trace ! ( self , "Remote HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1660
- let witness_data = InputMaterial :: Revoked { per_commitment_point, key : revocation_key , input_descriptor : InputDescriptors :: RevokedOutput , amount : tx. output [ 0 ] . value } ;
1658
+ let witness_data = InputMaterial :: Revoked { per_commitment_point, per_commitment_key , input_descriptor : InputDescriptors :: RevokedOutput , amount : tx. output [ 0 ] . value } ;
1661
1659
let claimable_outpoints = vec ! ( ClaimRequest { absolute_timelock: height + self . our_to_self_delay as u32 , aggregable: true , outpoint: BitcoinOutPoint { txid: htlc_txid, vout: 0 } , witness_data } ) ;
1662
1660
( claimable_outpoints, Some ( ( htlc_txid, tx. output . clone ( ) ) ) )
1663
1661
}
0 commit comments