@@ -451,21 +451,21 @@ struct LocalSignedTx {
451
451
#[ derive( Clone , PartialEq ) ]
452
452
pub ( crate ) enum InputMaterial {
453
453
Revoked {
454
- script : Script ,
454
+ witness_script : Script ,
455
455
pubkey : Option < PublicKey > ,
456
456
key : SecretKey ,
457
457
is_htlc : bool ,
458
458
amount : u64 ,
459
459
} ,
460
460
RemoteHTLC {
461
- script : Script ,
461
+ witness_script : Script ,
462
462
key : SecretKey ,
463
463
preimage : Option < PaymentPreimage > ,
464
464
amount : u64 ,
465
465
locktime : u32 ,
466
466
} ,
467
467
LocalHTLC {
468
- script : Script ,
468
+ witness_script : Script ,
469
469
sigs : ( Signature , Signature ) ,
470
470
preimage : Option < PaymentPreimage > ,
471
471
amount : u64 ,
@@ -475,25 +475,25 @@ pub(crate) enum InputMaterial {
475
475
impl Writeable for InputMaterial {
476
476
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
477
477
match self {
478
- & InputMaterial :: Revoked { ref script , ref pubkey, ref key, ref is_htlc, ref amount} => {
478
+ & InputMaterial :: Revoked { ref witness_script , ref pubkey, ref key, ref is_htlc, ref amount} => {
479
479
writer. write_all ( & [ 0 ; 1 ] ) ?;
480
- script . write ( writer) ?;
480
+ witness_script . write ( writer) ?;
481
481
pubkey. write ( writer) ?;
482
482
writer. write_all ( & key[ ..] ) ?;
483
483
is_htlc. write ( writer) ?;
484
484
writer. write_all ( & byte_utils:: be64_to_array ( * amount) ) ?;
485
485
} ,
486
- & InputMaterial :: RemoteHTLC { ref script , ref key, ref preimage, ref amount, ref locktime } => {
486
+ & InputMaterial :: RemoteHTLC { ref witness_script , ref key, ref preimage, ref amount, ref locktime } => {
487
487
writer. write_all ( & [ 1 ; 1 ] ) ?;
488
- script . write ( writer) ?;
488
+ witness_script . write ( writer) ?;
489
489
key. write ( writer) ?;
490
490
preimage. write ( writer) ?;
491
491
writer. write_all ( & byte_utils:: be64_to_array ( * amount) ) ?;
492
492
writer. write_all ( & byte_utils:: be32_to_array ( * locktime) ) ?;
493
493
} ,
494
- & InputMaterial :: LocalHTLC { ref script , ref sigs, ref preimage, ref amount } => {
494
+ & InputMaterial :: LocalHTLC { ref witness_script , ref sigs, ref preimage, ref amount } => {
495
495
writer. write_all ( & [ 2 ; 1 ] ) ?;
496
- script . write ( writer) ?;
496
+ witness_script . write ( writer) ?;
497
497
sigs. 0 . write ( writer) ?;
498
498
sigs. 1 . write ( writer) ?;
499
499
preimage. write ( writer) ?;
@@ -508,41 +508,41 @@ impl Readable for InputMaterial {
508
508
fn read < R : :: std:: io:: Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
509
509
let input_material = match <u8 as Readable >:: read ( reader) ? {
510
510
0 => {
511
- let script = Readable :: read ( reader) ?;
511
+ let witness_script = Readable :: read ( reader) ?;
512
512
let pubkey = Readable :: read ( reader) ?;
513
513
let key = Readable :: read ( reader) ?;
514
514
let is_htlc = Readable :: read ( reader) ?;
515
515
let amount = Readable :: read ( reader) ?;
516
516
InputMaterial :: Revoked {
517
- script ,
517
+ witness_script ,
518
518
pubkey,
519
519
key,
520
520
is_htlc,
521
521
amount
522
522
}
523
523
} ,
524
524
1 => {
525
- let script = Readable :: read ( reader) ?;
525
+ let witness_script = Readable :: read ( reader) ?;
526
526
let key = Readable :: read ( reader) ?;
527
527
let preimage = Readable :: read ( reader) ?;
528
528
let amount = Readable :: read ( reader) ?;
529
529
let locktime = Readable :: read ( reader) ?;
530
530
InputMaterial :: RemoteHTLC {
531
- script ,
531
+ witness_script ,
532
532
key,
533
533
preimage,
534
534
amount,
535
535
locktime
536
536
}
537
537
} ,
538
538
2 => {
539
- let script = Readable :: read ( reader) ?;
539
+ let witness_script = Readable :: read ( reader) ?;
540
540
let their_sig = Readable :: read ( reader) ?;
541
541
let our_sig = Readable :: read ( reader) ?;
542
542
let preimage = Readable :: read ( reader) ?;
543
543
let amount = Readable :: read ( reader) ?;
544
544
InputMaterial :: LocalHTLC {
545
- script ,
545
+ witness_script ,
546
546
sigs : ( their_sig, our_sig) ,
547
547
preimage,
548
548
amount
@@ -1461,7 +1461,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1461
1461
// First, process non-htlc outputs (to_local & to_remote)
1462
1462
for ( idx, outp) in tx. output . iter ( ) . enumerate ( ) {
1463
1463
if outp. script_pubkey == revokeable_p2wsh {
1464
- let witness_data = InputMaterial :: Revoked { script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : outp. value } ;
1464
+ let witness_data = InputMaterial :: Revoked { witness_script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : outp. value } ;
1465
1465
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} ) ;
1466
1466
} else if Some ( & outp. script_pubkey ) == local_payment_p2wpkh. as_ref ( ) {
1467
1467
spendable_outputs. push ( SpendableOutputDescriptor :: DynamicOutputP2WPKH {
@@ -1482,7 +1482,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1482
1482
tx. output [ transaction_output_index as usize ] . script_pubkey != expected_script. to_v0_p2wsh ( ) {
1483
1483
return ( claimable_outpoints, ( commitment_txid, watch_outputs) , spendable_outputs) ; // Corrupted per_commitment_data, fuck this user
1484
1484
}
1485
- let witness_data = InputMaterial :: Revoked { script : expected_script, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : true , amount : tx. output [ transaction_output_index as usize ] . value } ;
1485
+ let witness_data = InputMaterial :: Revoked { witness_script : expected_script, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : true , amount : tx. output [ transaction_output_index as usize ] . value } ;
1486
1486
claimable_outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable : true , outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1487
1487
}
1488
1488
}
@@ -1646,7 +1646,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1646
1646
let preimage = if htlc. offered { if let Some ( p) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
1647
1647
let aggregable = if !htlc. offered { false } else { true } ;
1648
1648
if preimage. is_some ( ) || !htlc. offered {
1649
- let witness_data = InputMaterial :: RemoteHTLC { script : expected_script, key : htlc_privkey, preimage, amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1649
+ let witness_data = InputMaterial :: RemoteHTLC { witness_script : expected_script, key : htlc_privkey, preimage, amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1650
1650
claimable_outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable, outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1651
1651
}
1652
1652
}
@@ -1701,7 +1701,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1701
1701
let htlc_txid = tx. txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
1702
1702
1703
1703
log_trace ! ( self , "Remote HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1704
- let witness_data = InputMaterial :: Revoked { script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : tx. output [ 0 ] . value } ;
1704
+ let witness_data = InputMaterial :: Revoked { witness_script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : tx. output [ 0 ] . value } ;
1705
1705
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 } ) ;
1706
1706
claimable_outpoints
1707
1707
}
@@ -1749,7 +1749,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1749
1749
1750
1750
add_dynamic_output ! ( htlc_timeout_tx, 0 ) ;
1751
1751
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1752
- per_input_material. insert ( htlc_timeout_tx. input [ 0 ] . previous_output , InputMaterial :: LocalHTLC { script : htlc_script, sigs : ( * their_sig, our_sig) , preimage : None , amount : htlc. amount_msat / 1000 } ) ;
1752
+ per_input_material. insert ( htlc_timeout_tx. input [ 0 ] . previous_output , InputMaterial :: LocalHTLC { witness_script : htlc_script, sigs : ( * their_sig, our_sig) , preimage : None , amount : htlc. amount_msat / 1000 } ) ;
1753
1753
//TODO: with option_simplified_commitment track outpoint too
1754
1754
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_timeout_tx. input[ 0 ] . previous_output. vout, htlc_timeout_tx. input[ 0 ] . previous_output. txid) ;
1755
1755
res. push ( htlc_timeout_tx) ;
@@ -1765,7 +1765,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1765
1765
1766
1766
add_dynamic_output ! ( htlc_success_tx, 0 ) ;
1767
1767
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1768
- per_input_material. insert ( htlc_success_tx. input [ 0 ] . previous_output , InputMaterial :: LocalHTLC { script : htlc_script, sigs : ( * their_sig, our_sig) , preimage : Some ( * payment_preimage) , amount : htlc. amount_msat / 1000 } ) ;
1768
+ per_input_material. insert ( htlc_success_tx. input [ 0 ] . previous_output , InputMaterial :: LocalHTLC { witness_script : htlc_script, sigs : ( * their_sig, our_sig) , preimage : Some ( * payment_preimage) , amount : htlc. amount_msat / 1000 } ) ;
1769
1769
//TODO: with option_simplified_commitment track outpoint too
1770
1770
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_success_tx. input[ 0 ] . previous_output. vout, htlc_success_tx. input[ 0 ] . previous_output. txid) ;
1771
1771
res. push ( htlc_success_tx) ;
0 commit comments