@@ -1500,7 +1500,7 @@ impl ChannelMonitor {
1500
1500
}
1501
1501
1502
1502
/// Attempts to claim a remote HTLC-Success/HTLC-Timeout's outputs using the revocation key
1503
- fn check_spend_remote_htlc ( & self , tx : & Transaction , commitment_number : u64 ) -> ( Option < Transaction > , Option < SpendableOutputDescriptor > ) {
1503
+ fn check_spend_remote_htlc ( & self , tx : & Transaction , commitment_number : u64 , fee_estimator : & FeeEstimator ) -> ( Option < Transaction > , Option < SpendableOutputDescriptor > ) {
1504
1504
if tx. input . len ( ) != 1 || tx. output . len ( ) != 1 {
1505
1505
return ( None , None )
1506
1506
}
@@ -1552,7 +1552,7 @@ impl ChannelMonitor {
1552
1552
if !inputs. is_empty ( ) {
1553
1553
let outputs = vec ! ( TxOut {
1554
1554
script_pubkey: self . destination_script. clone( ) ,
1555
- value: amount, //TODO: - fee
1555
+ value: amount
1556
1556
} ) ;
1557
1557
1558
1558
let mut spend_tx = Transaction {
@@ -1561,6 +1561,7 @@ impl ChannelMonitor {
1561
1561
input : inputs,
1562
1562
output : outputs,
1563
1563
} ;
1564
+ spend_tx. output [ 0 ] . value -= fee_estimator. get_est_sat_per_1000_weight ( ConfirmationTarget :: HighPriority ) * ( spend_tx. get_weight ( ) + Self :: get_witnesses_weight ( & vec ! [ InputDescriptors :: RevokedOutput ] ) ) / 1000 ;
1564
1565
1565
1566
let sighash_parts = bip143:: SighashComponents :: new ( & spend_tx) ;
1566
1567
@@ -1792,7 +1793,7 @@ impl ChannelMonitor {
1792
1793
}
1793
1794
} else {
1794
1795
if let Some ( & ( commitment_number, _) ) = self . remote_commitment_txn_on_chain . get ( & prevout. txid ) {
1795
- let ( tx, spendable_output) = self . check_spend_remote_htlc ( tx, commitment_number) ;
1796
+ let ( tx, spendable_output) = self . check_spend_remote_htlc ( tx, commitment_number, fee_estimator ) ;
1796
1797
if let Some ( tx) = tx {
1797
1798
txn. push ( tx) ;
1798
1799
}
0 commit comments