@@ -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
revoked_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
remote_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
local_amount : u64 ,
@@ -475,9 +475,9 @@ 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 revoked_amount} => {
478
+ & InputMaterial :: Revoked { ref witness_script , ref pubkey, ref key, ref is_htlc, ref revoked_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
if * is_htlc {
@@ -487,17 +487,17 @@ impl Writeable for InputMaterial {
487
487
}
488
488
writer. write_all ( & byte_utils:: be64_to_array ( * revoked_amount) ) ?;
489
489
} ,
490
- & InputMaterial :: RemoteHTLC { ref script , ref key, ref preimage, ref remote_amount, ref locktime } => {
490
+ & InputMaterial :: RemoteHTLC { ref witness_script , ref key, ref preimage, ref remote_amount, ref locktime } => {
491
491
writer. write_all ( & [ 1 ; 1 ] ) ?;
492
- script . write ( writer) ?;
492
+ witness_script . write ( writer) ?;
493
493
key. write ( writer) ?;
494
494
preimage. write ( writer) ?;
495
495
writer. write_all ( & byte_utils:: be64_to_array ( * remote_amount) ) ?;
496
496
writer. write_all ( & byte_utils:: be32_to_array ( * locktime) ) ?;
497
497
} ,
498
- & InputMaterial :: LocalHTLC { ref script , ref sigs, ref preimage, ref local_amount } => {
498
+ & InputMaterial :: LocalHTLC { ref witness_script , ref sigs, ref preimage, ref local_amount } => {
499
499
writer. write_all ( & [ 2 ; 1 ] ) ?;
500
- script . write ( writer) ?;
500
+ witness_script . write ( writer) ?;
501
501
sigs. 0 . write ( writer) ?;
502
502
sigs. 1 . write ( writer) ?;
503
503
preimage. write ( writer) ?;
@@ -512,7 +512,7 @@ impl<R: ::std::io::Read> Readable<R> for InputMaterial {
512
512
fn read ( reader : & mut R ) -> Result < Self , DecodeError > {
513
513
let input_material = match <u8 as Readable < R > >:: read ( reader) ? {
514
514
0 => {
515
- let script = Readable :: read ( reader) ?;
515
+ let witness_script = Readable :: read ( reader) ?;
516
516
let pubkey = Readable :: read ( reader) ?;
517
517
let key = Readable :: read ( reader) ?;
518
518
let is_htlc = match <u8 as Readable < R > >:: read ( reader) ? {
@@ -522,35 +522,35 @@ impl<R: ::std::io::Read> Readable<R> for InputMaterial {
522
522
} ;
523
523
let revoked_amount = Readable :: read ( reader) ?;
524
524
InputMaterial :: Revoked {
525
- script ,
525
+ witness_script ,
526
526
pubkey,
527
527
key,
528
528
is_htlc,
529
529
revoked_amount
530
530
}
531
531
} ,
532
532
1 => {
533
- let script = Readable :: read ( reader) ?;
533
+ let witness_script = Readable :: read ( reader) ?;
534
534
let key = Readable :: read ( reader) ?;
535
535
let preimage = Readable :: read ( reader) ?;
536
536
let remote_amount = Readable :: read ( reader) ?;
537
537
let locktime = Readable :: read ( reader) ?;
538
538
InputMaterial :: RemoteHTLC {
539
- script ,
539
+ witness_script ,
540
540
key,
541
541
preimage,
542
542
remote_amount,
543
543
locktime
544
544
}
545
545
} ,
546
546
2 => {
547
- let script = Readable :: read ( reader) ?;
547
+ let witness_script = Readable :: read ( reader) ?;
548
548
let their_sig = Readable :: read ( reader) ?;
549
549
let our_sig = Readable :: read ( reader) ?;
550
550
let preimage = Readable :: read ( reader) ?;
551
551
let local_amount = Readable :: read ( reader) ?;
552
552
InputMaterial :: LocalHTLC {
553
- script ,
553
+ witness_script ,
554
554
sigs : ( their_sig, our_sig) ,
555
555
preimage,
556
556
local_amount
@@ -1488,7 +1488,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1488
1488
// First, process non-htlc outputs (to_local & to_remote)
1489
1489
for ( idx, outp) in tx. output . iter ( ) . enumerate ( ) {
1490
1490
if outp. script_pubkey == revokeable_p2wsh {
1491
- let witness_data = InputMaterial :: Revoked { script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : outp. value } ;
1491
+ let witness_data = InputMaterial :: Revoked { witness_script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : outp. value } ;
1492
1492
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} ) ;
1493
1493
} else if Some ( & outp. script_pubkey ) == local_payment_p2wpkh. as_ref ( ) {
1494
1494
spendable_outputs. push ( SpendableOutputDescriptor :: DynamicOutputP2WPKH {
@@ -1509,7 +1509,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1509
1509
tx. output [ transaction_output_index as usize ] . script_pubkey != expected_script. to_v0_p2wsh ( ) {
1510
1510
return ( claim_requests_per_txid, ( commitment_txid, watch_outputs) , spendable_outputs) ; // Corrupted per_commitment_data, fuck this user
1511
1511
}
1512
- let witness_data = InputMaterial :: Revoked { script : expected_script, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : true , revoked_amount : tx. output [ transaction_output_index as usize ] . value } ;
1512
+ let witness_data = InputMaterial :: Revoked { witness_script : expected_script, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : true , revoked_amount : tx. output [ transaction_output_index as usize ] . value } ;
1513
1513
outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable : true , outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1514
1514
}
1515
1515
}
@@ -1673,7 +1673,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1673
1673
let preimage = if htlc. offered { if let Some ( p) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
1674
1674
let aggregable = if !htlc. offered { false } else { true } ;
1675
1675
if preimage. is_some ( ) || !htlc. offered {
1676
- let witness_data = InputMaterial :: RemoteHTLC { script : expected_script, key : htlc_privkey, preimage, remote_amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1676
+ let witness_data = InputMaterial :: RemoteHTLC { witness_script : expected_script, key : htlc_privkey, preimage, remote_amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1677
1677
outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable, outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1678
1678
}
1679
1679
}
@@ -1729,7 +1729,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1729
1729
let htlc_txid = tx. txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
1730
1730
1731
1731
log_trace ! ( self , "Remote HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1732
- let witness_data = InputMaterial :: Revoked { script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : tx. output [ 0 ] . value } ;
1732
+ let witness_data = InputMaterial :: Revoked { witness_script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : tx. output [ 0 ] . value } ;
1733
1733
let outpoints = vec ! ( ClaimRequest { absolute_timelock: height + self . our_to_self_delay as u32 , aggregable: true , outpoint: BitcoinOutPoint { txid: htlc_txid, vout: 0 } , witness_data } ) ;
1734
1734
let mut claimable_outpoints = HashMap :: with_capacity ( 1 ) ;
1735
1735
claimable_outpoints. insert ( htlc_txid, outpoints) ;
@@ -1779,7 +1779,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1779
1779
1780
1780
add_dynamic_output ! ( htlc_timeout_tx, 0 ) ;
1781
1781
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1782
- per_input_material. insert ( htlc_timeout_tx. input [ 0 ] . previous_output , InputMaterial :: LocalHTLC { script : htlc_script, sigs : ( * their_sig, our_sig) , preimage : None , local_amount : htlc. amount_msat / 1000 } ) ;
1782
+ per_input_material. insert ( htlc_timeout_tx. input [ 0 ] . previous_output , InputMaterial :: LocalHTLC { witness_script : htlc_script, sigs : ( * their_sig, our_sig) , preimage : None , local_amount : htlc. amount_msat / 1000 } ) ;
1783
1783
//TODO: with option_simplified_commitment track outpoint too
1784
1784
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_timeout_tx. input[ 0 ] . previous_output. vout, htlc_timeout_tx. input[ 0 ] . previous_output. txid) ;
1785
1785
res. push ( htlc_timeout_tx) ;
@@ -1795,7 +1795,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1795
1795
1796
1796
add_dynamic_output ! ( htlc_success_tx, 0 ) ;
1797
1797
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1798
- 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) , local_amount : htlc. amount_msat / 1000 } ) ;
1798
+ 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) , local_amount : htlc. amount_msat / 1000 } ) ;
1799
1799
//TODO: with option_simplified_commitment track outpoint too
1800
1800
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_success_tx. input[ 0 ] . previous_output. vout, htlc_success_tx. input[ 0 ] . previous_output. txid) ;
1801
1801
res. push ( htlc_success_tx) ;
0 commit comments