@@ -392,27 +392,27 @@ pub(crate) enum InputMaterial {
392
392
pubkey : Option < PublicKey > ,
393
393
key : SecretKey ,
394
394
is_htlc : bool ,
395
- amount : u64 ,
395
+ revoked_amount : u64 ,
396
396
} ,
397
397
RemoteHTLC {
398
398
script : Script ,
399
399
key : SecretKey ,
400
400
preimage : Option < PaymentPreimage > ,
401
- amount : u64 ,
401
+ remote_amount : u64 ,
402
402
locktime : u32 ,
403
403
} ,
404
404
LocalHTLC {
405
405
script : Script ,
406
406
sigs : ( Signature , Signature ) ,
407
407
preimage : Option < PaymentPreimage > ,
408
- amount : u64 ,
408
+ local_amount : u64 ,
409
409
}
410
410
}
411
411
412
412
impl Writeable for InputMaterial {
413
413
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
414
414
match self {
415
- & InputMaterial :: Revoked { ref script, ref pubkey, ref key, ref is_htlc, ref amount } => {
415
+ & InputMaterial :: Revoked { ref script, ref pubkey, ref key, ref is_htlc, ref revoked_amount } => {
416
416
writer. write_all ( & [ 0 ; 1 ] ) ?;
417
417
script. write ( writer) ?;
418
418
pubkey. write ( writer) ?;
@@ -422,23 +422,23 @@ impl Writeable for InputMaterial {
422
422
} else {
423
423
writer. write_all ( & [ 1 ; 1 ] ) ?;
424
424
}
425
- writer. write_all ( & byte_utils:: be64_to_array ( * amount ) ) ?;
425
+ writer. write_all ( & byte_utils:: be64_to_array ( * revoked_amount ) ) ?;
426
426
} ,
427
- & InputMaterial :: RemoteHTLC { ref script, ref key, ref preimage, ref amount , ref locktime } => {
427
+ & InputMaterial :: RemoteHTLC { ref script, ref key, ref preimage, ref remote_amount , ref locktime } => {
428
428
writer. write_all ( & [ 1 ; 1 ] ) ?;
429
429
script. write ( writer) ?;
430
430
key. write ( writer) ?;
431
431
preimage. write ( writer) ?;
432
- writer. write_all ( & byte_utils:: be64_to_array ( * amount ) ) ?;
432
+ writer. write_all ( & byte_utils:: be64_to_array ( * remote_amount ) ) ?;
433
433
writer. write_all ( & byte_utils:: be32_to_array ( * locktime) ) ?;
434
434
} ,
435
- & InputMaterial :: LocalHTLC { ref script, ref sigs, ref preimage, ref amount } => {
435
+ & InputMaterial :: LocalHTLC { ref script, ref sigs, ref preimage, ref local_amount } => {
436
436
writer. write_all ( & [ 2 ; 1 ] ) ?;
437
437
script. write ( writer) ?;
438
438
sigs. 0 . write ( writer) ?;
439
439
sigs. 1 . write ( writer) ?;
440
440
preimage. write ( writer) ?;
441
- writer. write_all ( & byte_utils:: be64_to_array ( * amount ) ) ?;
441
+ writer. write_all ( & byte_utils:: be64_to_array ( * local_amount ) ) ?;
442
442
}
443
443
}
444
444
Ok ( ( ) )
@@ -457,26 +457,26 @@ impl<R: ::std::io::Read> Readable<R> for InputMaterial {
457
457
1 => false ,
458
458
_ => return Err ( DecodeError :: InvalidValue ) ,
459
459
} ;
460
- let amount = Readable :: read ( reader) ?;
460
+ let revoked_amount = Readable :: read ( reader) ?;
461
461
InputMaterial :: Revoked {
462
462
script,
463
463
pubkey,
464
464
key,
465
465
is_htlc,
466
- amount
466
+ revoked_amount
467
467
}
468
468
} ,
469
469
1 => {
470
470
let script = Readable :: read ( reader) ?;
471
471
let key = Readable :: read ( reader) ?;
472
472
let preimage = Readable :: read ( reader) ?;
473
- let amount = Readable :: read ( reader) ?;
473
+ let remote_amount = Readable :: read ( reader) ?;
474
474
let locktime = Readable :: read ( reader) ?;
475
475
InputMaterial :: RemoteHTLC {
476
476
script,
477
477
key,
478
478
preimage,
479
- amount ,
479
+ remote_amount ,
480
480
locktime
481
481
}
482
482
} ,
@@ -485,12 +485,12 @@ impl<R: ::std::io::Read> Readable<R> for InputMaterial {
485
485
let their_sig = Readable :: read ( reader) ?;
486
486
let our_sig = Readable :: read ( reader) ?;
487
487
let preimage = Readable :: read ( reader) ?;
488
- let amount = Readable :: read ( reader) ?;
488
+ let local_amount = Readable :: read ( reader) ?;
489
489
InputMaterial :: LocalHTLC {
490
490
script,
491
491
sigs : ( their_sig, our_sig) ,
492
492
preimage,
493
- amount
493
+ local_amount
494
494
}
495
495
}
496
496
_ => return Err ( DecodeError :: InvalidValue ) ,
@@ -1308,7 +1308,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1308
1308
// First, process non-htlc outputs (to_local & to_remote)
1309
1309
for ( idx, outp) in tx. output . iter ( ) . enumerate ( ) {
1310
1310
if outp. script_pubkey == revokeable_p2wsh {
1311
- let witness_data = InputMaterial :: Revoked { script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : outp. value } ;
1311
+ let witness_data = InputMaterial :: Revoked { script : revokeable_redeemscript. clone ( ) , pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : outp. value } ;
1312
1312
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} ) ;
1313
1313
} else if Some ( & outp. script_pubkey ) == local_payment_p2wpkh. as_ref ( ) {
1314
1314
spendable_descriptor = Some ( SpendableOutputDescriptor :: DynamicOutputP2WPKH {
@@ -1329,7 +1329,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1329
1329
tx. output [ transaction_output_index as usize ] . script_pubkey != expected_script. to_v0_p2wsh ( ) {
1330
1330
return ( claimable_outpoints, ( commitment_txid, watch_outputs) , spendable_descriptor) ; // Corrupted per_commitment_data, fuck this user
1331
1331
}
1332
- 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 } ;
1332
+ 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 } ;
1333
1333
outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable : true , outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1334
1334
}
1335
1335
}
@@ -1493,7 +1493,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1493
1493
let preimage = if htlc. offered { if let Some ( p) = self . payment_preimages . get ( & htlc. payment_hash ) { Some ( * p) } else { None } } else { None } ;
1494
1494
let aggregable = if !htlc. offered { false } else { true } ;
1495
1495
if preimage. is_some ( ) || !htlc. offered {
1496
- let witness_data = InputMaterial :: RemoteHTLC { script : expected_script, key : htlc_privkey, preimage, amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1496
+ let witness_data = InputMaterial :: RemoteHTLC { script : expected_script, key : htlc_privkey, preimage, remote_amount : htlc. amount_msat / 1000 , locktime : htlc. cltv_expiry } ;
1497
1497
outpoints. push ( ClaimRequest { absolute_timelock : htlc. cltv_expiry , aggregable, outpoint : BitcoinOutPoint { txid : commitment_txid, vout : transaction_output_index } , witness_data } ) ;
1498
1498
}
1499
1499
}
@@ -1549,7 +1549,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1549
1549
let htlc_txid = tx. txid ( ) ; //TODO: This is gonna be a performance bottleneck for watchtowers!
1550
1550
1551
1551
log_trace ! ( self , "Remote HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1552
- let witness_data = InputMaterial :: Revoked { script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , amount : tx. output [ 0 ] . value } ;
1552
+ let witness_data = InputMaterial :: Revoked { script : redeemscript, pubkey : Some ( revocation_pubkey) , key : revocation_key, is_htlc : false , revoked_amount : tx. output [ 0 ] . value } ;
1553
1553
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 } ) ;
1554
1554
let mut claimable_outpoints = HashMap :: with_capacity ( 1 ) ;
1555
1555
claimable_outpoints. insert ( htlc_txid, outpoints) ;
@@ -1599,7 +1599,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1599
1599
1600
1600
add_dynamic_output ! ( htlc_timeout_tx, 0 ) ;
1601
1601
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1602
- 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 } ) ;
1602
+ 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 } ) ;
1603
1603
//TODO: with option_simplified_commitment track outpoint too
1604
1604
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_timeout_tx. input[ 0 ] . previous_output. vout, htlc_timeout_tx. input[ 0 ] . previous_output. txid) ;
1605
1605
res. push ( htlc_timeout_tx) ;
@@ -1615,7 +1615,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
1615
1615
1616
1616
add_dynamic_output ! ( htlc_success_tx, 0 ) ;
1617
1617
let mut per_input_material = HashMap :: with_capacity ( 1 ) ;
1618
- 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 } ) ;
1618
+ 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 } ) ;
1619
1619
//TODO: with option_simplified_commitment track outpoint too
1620
1620
log_trace ! ( self , "Outpoint {}:{} is being being claimed" , htlc_success_tx. input[ 0 ] . previous_output. vout, htlc_success_tx. input[ 0 ] . previous_output. txid) ;
1621
1621
res. push ( htlc_success_tx) ;
0 commit comments