@@ -43,7 +43,7 @@ use chain::chaininterface::{BroadcasterInterface, FeeEstimator};
43
43
use chain:: transaction:: { OutPoint , TransactionData } ;
44
44
use chain:: keysinterface:: { SpendableOutputDescriptor , StaticPaymentOutputDescriptor , DelayedPaymentOutputDescriptor , Sign , KeysInterface } ;
45
45
use chain:: onchaintx:: OnchainTxHandler ;
46
- use chain:: onchain_utils:: { CounterpartyHTLCOutput , HolderFundingOutput , HolderHTLCOutput , InputDescriptors , OnchainRequest , PackageMalleability , PackageSolvingData , PackageTemplate , RevokedOutput } ;
46
+ use chain:: onchain_utils:: { CounterpartyHTLCOutput , HolderFundingOutput , HolderHTLCOutput , InputDescriptors , PackageMalleability , PackageSolvingData , PackageTemplate , RevokedOutput } ;
47
47
use chain:: Filter ;
48
48
use util:: logger:: Logger ;
49
49
use util:: ser:: { Readable , ReadableArgs , MaybeReadable , Writer , Writeable , U48 } ;
@@ -1549,7 +1549,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1549
1549
/// HTLC-Success/HTLC-Timeout transactions.
1550
1550
/// Return updates for HTLC pending in the channel and failed automatically by the broadcast of
1551
1551
/// revoked counterparty commitment tx
1552
- fn check_spend_counterparty_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < OnchainRequest > , TransactionOutputs ) where L :: Target : Logger {
1552
+ fn check_spend_counterparty_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < PackageTemplate > , TransactionOutputs ) where L :: Target : Logger {
1553
1553
// Most secp and related errors trying to create keys means we have no hope of constructing
1554
1554
// a spend transaction...so we return no transactions to broadcast
1555
1555
let mut claimable_outpoints = Vec :: new ( ) ;
@@ -1583,7 +1583,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1583
1583
if outp. script_pubkey == revokeable_p2wsh {
1584
1584
let revk_outp = RevokedOutput :: build ( per_commitment_point, per_commitment_key, self . counterparty_tx_cache . counterparty_delayed_payment_base_key , self . counterparty_tx_cache . counterparty_htlc_base_key , InputDescriptors :: RevokedOutput , outp. value , None , self . counterparty_tx_cache . on_counterparty_tx_csv ) ;
1585
1585
let justice_package = PackageTemplate :: build_package ( commitment_txid, idx as u32 , PackageSolvingData :: RevokedOutput ( revk_outp) , PackageMalleability :: Malleable , height + self . counterparty_tx_cache . on_counterparty_tx_csv as u32 , true , 0 , None , height) ;
1586
- claimable_outpoints. push ( OnchainRequest { content : justice_package} ) ;
1586
+ claimable_outpoints. push ( justice_package) ;
1587
1587
}
1588
1588
}
1589
1589
@@ -1597,7 +1597,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1597
1597
}
1598
1598
let revk_outp = RevokedOutput :: build ( per_commitment_point, per_commitment_key, self . counterparty_tx_cache . counterparty_delayed_payment_base_key , self . counterparty_tx_cache . counterparty_htlc_base_key , if htlc. offered { InputDescriptors :: RevokedOfferedHTLC } else { InputDescriptors :: RevokedReceivedHTLC } , htlc. amount_msat / 1000 , Some ( htlc. clone ( ) ) , self . counterparty_tx_cache . on_counterparty_tx_csv ) ;
1599
1599
let justice_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, PackageSolvingData :: RevokedOutput ( revk_outp) , PackageMalleability :: Malleable , htlc. cltv_expiry , true , 0 , None , height) ;
1600
- claimable_outpoints. push ( OnchainRequest { content : justice_package} ) ;
1600
+ claimable_outpoints. push ( justice_package) ;
1601
1601
}
1602
1602
}
1603
1603
}
@@ -1719,7 +1719,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1719
1719
( claimable_outpoints, ( commitment_txid, watch_outputs) )
1720
1720
}
1721
1721
1722
- fn get_counterparty_htlc_output_claim_reqs ( & self , commitment_number : u64 , commitment_txid : Txid , tx : Option < & Transaction > ) -> Vec < OnchainRequest > {
1722
+ fn get_counterparty_htlc_output_claim_reqs ( & self , commitment_number : u64 , commitment_txid : Txid , tx : Option < & Transaction > ) -> Vec < PackageTemplate > {
1723
1723
let mut claimable_outpoints = Vec :: new ( ) ;
1724
1724
if let Some ( htlc_outputs) = self . counterparty_claimable_outpoints . get ( & commitment_txid) {
1725
1725
if let Some ( revocation_points) = self . their_cur_revocation_points {
@@ -1746,7 +1746,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1746
1746
if preimage. is_some ( ) || !htlc. offered {
1747
1747
let counterparty_htlc_outp = CounterpartyHTLCOutput :: build ( * revocation_point, self . counterparty_tx_cache . counterparty_delayed_payment_base_key , self . counterparty_tx_cache . counterparty_htlc_base_key , preimage, htlc. clone ( ) ) ;
1748
1748
let counterparty_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, PackageSolvingData :: CounterpartyHTLCOutput ( counterparty_htlc_outp) , PackageMalleability :: Malleable , htlc. cltv_expiry , if !htlc. offered { false } else { true } , 0 , None , 0 ) ;
1749
- claimable_outpoints. push ( OnchainRequest { content : counterparty_package } ) ;
1749
+ claimable_outpoints. push ( counterparty_package) ;
1750
1750
}
1751
1751
}
1752
1752
}
@@ -1757,7 +1757,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1757
1757
}
1758
1758
1759
1759
/// Attempts to claim a counterparty HTLC-Success/HTLC-Timeout's outputs using the revocation key
1760
- fn check_spend_counterparty_htlc < L : Deref > ( & mut self , tx : & Transaction , commitment_number : u64 , height : u32 , logger : & L ) -> ( Vec < OnchainRequest > , Option < TransactionOutputs > ) where L :: Target : Logger {
1760
+ fn check_spend_counterparty_htlc < L : Deref > ( & mut self , tx : & Transaction , commitment_number : u64 , height : u32 , logger : & L ) -> ( Vec < PackageTemplate > , Option < TransactionOutputs > ) where L :: Target : Logger {
1761
1761
let htlc_txid = tx. txid ( ) ;
1762
1762
if tx. input . len ( ) != 1 || tx. output . len ( ) != 1 || tx. input [ 0 ] . witness . len ( ) != 5 {
1763
1763
return ( Vec :: new ( ) , None )
@@ -1779,15 +1779,15 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1779
1779
log_trace ! ( logger, "Counterparty HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1780
1780
let revk_outp = RevokedOutput :: build ( per_commitment_point, per_commitment_key, self . counterparty_tx_cache . counterparty_delayed_payment_base_key , self . counterparty_tx_cache . counterparty_htlc_base_key , InputDescriptors :: RevokedOutput , tx. output [ 0 ] . value , None , self . counterparty_tx_cache . on_counterparty_tx_csv ) ;
1781
1781
let justice_package = PackageTemplate :: build_package ( htlc_txid, 0 , PackageSolvingData :: RevokedOutput ( revk_outp) , PackageMalleability :: Malleable , height + self . counterparty_tx_cache . on_counterparty_tx_csv as u32 , true , 0 , None , height) ;
1782
- let claimable_outpoints = vec ! ( OnchainRequest { content : justice_package } ) ;
1782
+ let claimable_outpoints = vec ! ( justice_package) ;
1783
1783
let outputs = vec ! [ ( 0 , tx. output[ 0 ] . clone( ) ) ] ;
1784
1784
( claimable_outpoints, Some ( ( htlc_txid, outputs) ) )
1785
1785
}
1786
1786
1787
- // Returns (1) `OnchainRequest `s that can be given to the OnChainTxHandler, so that the handler can
1787
+ // Returns (1) `PackageTemplate `s that can be given to the OnChainTxHandler, so that the handler can
1788
1788
// broadcast transactions claiming holder HTLC commitment outputs and (2) a holder revokable
1789
1789
// script so we can detect whether a holder transaction has been seen on-chain.
1790
- fn get_broadcasted_holder_claims ( & self , holder_tx : & HolderSignedTx , height : u32 ) -> ( Vec < OnchainRequest > , Option < ( Script , PublicKey , PublicKey ) > ) {
1790
+ fn get_broadcasted_holder_claims ( & self , holder_tx : & HolderSignedTx , height : u32 ) -> ( Vec < PackageTemplate > , Option < ( Script , PublicKey , PublicKey ) > ) {
1791
1791
let mut claim_requests = Vec :: with_capacity ( holder_tx. htlc_outputs . len ( ) ) ;
1792
1792
1793
1793
let redeemscript = chan_utils:: get_revokeable_redeemscript ( & holder_tx. revocation_key , self . on_holder_tx_csv , & holder_tx. delayed_payment_key ) ;
@@ -1804,7 +1804,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1804
1804
}
1805
1805
} else { None } , htlc. amount_msat ) ;
1806
1806
let htlc_package = PackageTemplate :: build_package ( holder_tx. txid , transaction_output_index, PackageSolvingData :: HolderHTLCOutput ( htlc_output) , PackageMalleability :: Untractable , height, false , 0 , None , height) ;
1807
- claim_requests. push ( OnchainRequest { content : htlc_package } ) ;
1807
+ claim_requests. push ( htlc_package) ;
1808
1808
}
1809
1809
}
1810
1810
@@ -1825,7 +1825,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1825
1825
/// Attempts to claim any claimable HTLCs in a commitment transaction which was not (yet)
1826
1826
/// revoked using data in holder_claimable_outpoints.
1827
1827
/// Should not be used if check_spend_revoked_transaction succeeds.
1828
- fn check_spend_holder_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < OnchainRequest > , TransactionOutputs ) where L :: Target : Logger {
1828
+ fn check_spend_holder_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < PackageTemplate > , TransactionOutputs ) where L :: Target : Logger {
1829
1829
let commitment_txid = tx. txid ( ) ;
1830
1830
let mut claim_requests = Vec :: new ( ) ;
1831
1831
let mut watch_outputs = Vec :: new ( ) ;
@@ -2064,7 +2064,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2064
2064
height : u32 ,
2065
2065
txn_matched : Vec < & Transaction > ,
2066
2066
mut watch_outputs : Vec < TransactionOutputs > ,
2067
- mut claimable_outpoints : Vec < OnchainRequest > ,
2067
+ mut claimable_outpoints : Vec < PackageTemplate > ,
2068
2068
broadcaster : B ,
2069
2069
fee_estimator : F ,
2070
2070
logger : L ,
@@ -2078,7 +2078,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2078
2078
if should_broadcast {
2079
2079
let funding_outp = HolderFundingOutput :: build ( self . funding_redeemscript . clone ( ) ) ;
2080
2080
let commitment_package = PackageTemplate :: build_package ( self . funding_info . 0 . txid . clone ( ) , self . funding_info . 0 . index as u32 , PackageSolvingData :: HolderFundingOutput ( funding_outp) , PackageMalleability :: Untractable , height, false , 0 , None , height) ;
2081
- claimable_outpoints. push ( OnchainRequest { content : commitment_package } ) ;
2081
+ claimable_outpoints. push ( commitment_package) ;
2082
2082
self . pending_monitor_events . push ( MonitorEvent :: CommitmentTxBroadcasted ( self . funding_info . 0 ) ) ;
2083
2083
let commitment_tx = self . onchain_tx_handler . get_fully_signed_holder_tx ( & self . funding_redeemscript ) ;
2084
2084
self . holder_tx_signed = true ;
0 commit comments