@@ -456,27 +456,27 @@ pub(crate) enum InputMaterial {
456
456
pubkey : Option < PublicKey > ,
457
457
key : SecretKey ,
458
458
is_htlc : bool ,
459
- amount : u64 ,
459
+ revoked_amount : u64 ,
460
460
} ,
461
461
RemoteHTLC {
462
462
script : Script ,
463
463
key : SecretKey ,
464
464
preimage : Option < PaymentPreimage > ,
465
- amount : u64 ,
465
+ remote_amount : u64 ,
466
466
locktime : u32 ,
467
467
} ,
468
468
LocalHTLC {
469
469
script : Script ,
470
470
sigs : ( Signature , Signature ) ,
471
471
preimage : Option < PaymentPreimage > ,
472
- amount : u64 ,
472
+ local_amount : u64 ,
473
473
}
474
474
}
475
475
476
476
impl Writeable for InputMaterial {
477
477
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
478
478
match self {
479
- & InputMaterial :: Revoked { ref script, ref pubkey, ref key, ref is_htlc, ref amount } => {
479
+ & InputMaterial :: Revoked { ref script, ref pubkey, ref key, ref is_htlc, ref revoked_amount } => {
480
480
writer. write_all ( & [ 0 ; 1 ] ) ?;
481
481
script. write ( writer) ?;
482
482
pubkey. write ( writer) ?;
@@ -486,23 +486,23 @@ impl Writeable for InputMaterial {
486
486
} else {
487
487
writer. write_all ( & [ 1 ; 1 ] ) ?;
488
488
}
489
- writer. write_all ( & byte_utils:: be64_to_array ( * amount ) ) ?;
489
+ writer. write_all ( & byte_utils:: be64_to_array ( * revoked_amount ) ) ?;
490
490
} ,
491
- & InputMaterial :: RemoteHTLC { ref script, ref key, ref preimage, ref amount , ref locktime } => {
491
+ & InputMaterial :: RemoteHTLC { ref script, ref key, ref preimage, ref remote_amount , ref locktime } => {
492
492
writer. write_all ( & [ 1 ; 1 ] ) ?;
493
493
script. write ( writer) ?;
494
494
key. write ( writer) ?;
495
495
preimage. write ( writer) ?;
496
- writer. write_all ( & byte_utils:: be64_to_array ( * amount ) ) ?;
496
+ writer. write_all ( & byte_utils:: be64_to_array ( * remote_amount ) ) ?;
497
497
writer. write_all ( & byte_utils:: be32_to_array ( * locktime) ) ?;
498
498
} ,
499
- & InputMaterial :: LocalHTLC { ref script, ref sigs, ref preimage, ref amount } => {
499
+ & InputMaterial :: LocalHTLC { ref script, ref sigs, ref preimage, ref local_amount } => {
500
500
writer. write_all ( & [ 2 ; 1 ] ) ?;
501
501
script. write ( writer) ?;
502
502
sigs. 0 . write ( writer) ?;
503
503
sigs. 1 . write ( writer) ?;
504
504
preimage. write ( writer) ?;
505
- writer. write_all ( & byte_utils:: be64_to_array ( * amount ) ) ?;
505
+ writer. write_all ( & byte_utils:: be64_to_array ( * local_amount ) ) ?;
506
506
}
507
507
}
508
508
Ok ( ( ) )
@@ -521,26 +521,26 @@ impl<R: ::std::io::Read> Readable<R> for InputMaterial {
521
521
1 => false ,
522
522
_ => return Err ( DecodeError :: InvalidValue ) ,
523
523
} ;
524
- let amount = Readable :: read ( reader) ?;
524
+ let revoked_amount = Readable :: read ( reader) ?;
525
525
InputMaterial :: Revoked {
526
526
script,
527
527
pubkey,
528
528
key,
529
529
is_htlc,
530
- amount
530
+ revoked_amount
531
531
}
532
532
} ,
533
533
1 => {
534
534
let script = Readable :: read ( reader) ?;
535
535
let key = Readable :: read ( reader) ?;
536
536
let preimage = Readable :: read ( reader) ?;
537
- let amount = Readable :: read ( reader) ?;
537
+ let remote_amount = Readable :: read ( reader) ?;
538
538
let locktime = Readable :: read ( reader) ?;
539
539
InputMaterial :: RemoteHTLC {
540
540
script,
541
541
key,
542
542
preimage,
543
- amount ,
543
+ remote_amount ,
544
544
locktime
545
545
}
546
546
} ,
@@ -549,12 +549,12 @@ impl<R: ::std::io::Read> Readable<R> for InputMaterial {
549
549
let their_sig = Readable :: read ( reader) ?;
550
550
let our_sig = Readable :: read ( reader) ?;
551
551
let preimage = Readable :: read ( reader) ?;
552
- let amount = Readable :: read ( reader) ?;
552
+ let local_amount = Readable :: read ( reader) ?;
553
553
InputMaterial :: LocalHTLC {
554
554
script,
555
555
sigs : ( their_sig, our_sig) ,
556
556
preimage,
557
- amount
557
+ local_amount
558
558
}
559
559
}
560
560
_ => return Err ( DecodeError :: InvalidValue ) ,
@@ -1464,7 +1464,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1464
1464
// First, process non-htlc outputs (to_local & to_remote)
1465
1465
for ( idx, outp) in tx. output . iter ( ) . enumerate ( ) {
1466
1466
if outp. script_pubkey == revokeable_p2wsh {
1467
- let witness_data = InputMaterial :: Revoked { script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : outp. value } ;
1467
+ let witness_data = InputMaterial :: Revoked { script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : outp. value } ;
1468
1468
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} ) ;
1469
1469
} else if Some ( & outp. script_pubkey ) == local_payment_p2wpkh. as_ref ( ) {
1470
1470
spendable_descriptor = Some ( SpendableOutputDescriptor :: DynamicOutputP2WPKH {
@@ -1485,7 +1485,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1485
1485
tx. output [ transaction_output_index as usize ] . script_pubkey != expected_script. to_v0_p2wsh ( ) {
1486
1486
return ( claimable_outpoints, ( commitment_txid, watch_outputs) , spendable_descriptor) ; // Corrupted per_commitment_data, fuck this user
1487
1487
}
1488
- 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 } ;
1488
+ 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 } ;
1489
1489
outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable : true , outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1490
1490
}
1491
1491
}
@@ -1649,7 +1649,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1649
1649
let preimage = if htlc. offered { if let Some ( p) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
1650
1650
let aggregable = if !htlc. offered { false } else { true } ;
1651
1651
if preimage. is_some ( ) || !htlc. offered {
1652
- let witness_data = InputMaterial :: RemoteHTLC { script : expected_script, key : htlc_privkey, preimage, amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1652
+ let witness_data = InputMaterial :: RemoteHTLC { script : expected_script, key : htlc_privkey, preimage, remote_amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1653
1653
outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable, outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1654
1654
}
1655
1655
}
@@ -1705,7 +1705,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1705
1705
let htlc_txid = tx. txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
1706
1706
1707
1707
log_trace ! ( self , "Remote HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1708
- let witness_data = InputMaterial :: Revoked { script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : tx. output [ 0 ] . value } ;
1708
+ let witness_data = InputMaterial :: Revoked { script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : tx. output [ 0 ] . value } ;
1709
1709
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 } ) ;
1710
1710
let mut claimable_outpoints = HashMap :: with_capacity ( 1 ) ;
1711
1711
claimable_outpoints. insert ( htlc_txid, outpoints) ;
@@ -1755,7 +1755,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1755
1755
1756
1756
add_dynamic_output ! ( htlc_timeout_tx, 0 ) ;
1757
1757
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1758
- 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 } ) ;
1758
+ 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 } ) ;
1759
1759
//TODO: with option_simplified_commitment track outpoint too
1760
1760
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_timeout_tx. input[ 0 ] . previous_output. vout, htlc_timeout_tx. input[ 0 ] . previous_output. txid) ;
1761
1761
res. push ( htlc_timeout_tx) ;
@@ -1771,7 +1771,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1771
1771
1772
1772
add_dynamic_output ! ( htlc_success_tx, 0 ) ;
1773
1773
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1774
- 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 } ) ;
1774
+ 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 } ) ;
1775
1775
//TODO: with option_simplified_commitment track outpoint too
1776
1776
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_success_tx. input[ 0 ] . previous_output. vout, htlc_success_tx. input[ 0 ] . previous_output. txid) ;
1777
1777
res. push ( htlc_success_tx) ;
0 commit comments