@@ -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 } ;
@@ -1429,7 +1429,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1429
1429
/// HTLC-Success/HTLC-Timeout transactions.
1430
1430
/// Return updates for HTLC pending in the channel and failed automatically by the broadcast of
1431
1431
/// revoked counterparty commitment tx
1432
- fn check_spend_counterparty_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < OnchainRequest > , ( Txid , Vec < ( u32 , TxOut ) > ) ) where L :: Target : Logger {
1432
+ fn check_spend_counterparty_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < PackageTemplate > , ( Txid , Vec < ( u32 , TxOut ) > ) ) where L :: Target : Logger {
1433
1433
// Most secp and related errors trying to create keys means we have no hope of constructing
1434
1434
// a spend transaction...so we return no transactions to broadcast
1435
1435
let mut claimable_outpoints = Vec :: new ( ) ;
@@ -1463,7 +1463,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1463
1463
if outp. script_pubkey == revokeable_p2wsh {
1464
1464
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 ) ;
1465
1465
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) ;
1466
- claimable_outpoints. push ( OnchainRequest { content : justice_package} ) ;
1466
+ claimable_outpoints. push ( justice_package) ;
1467
1467
}
1468
1468
}
1469
1469
@@ -1477,7 +1477,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1477
1477
}
1478
1478
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 ) ;
1479
1479
let justice_package = PackageTemplate :: build_package ( commitment_txid, transaction_output_index, PackageSolvingData :: RevokedOutput ( revk_outp) , PackageMalleability :: Malleable , htlc. cltv_expiry , true , 0 , None , height) ;
1480
- claimable_outpoints. push ( OnchainRequest { content : justice_package} ) ;
1480
+ claimable_outpoints. push ( justice_package) ;
1481
1481
}
1482
1482
}
1483
1483
}
@@ -1600,7 +1600,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1600
1600
( claimable_outpoints, ( commitment_txid, watch_outputs) )
1601
1601
}
1602
1602
1603
- fn get_counterparty_htlc_output_claim_reqs ( & self , commitment_number : u64 , commitment_txid : Txid , tx : Option < & Transaction > ) -> Vec < OnchainRequest > {
1603
+ fn get_counterparty_htlc_output_claim_reqs ( & self , commitment_number : u64 , commitment_txid : Txid , tx : Option < & Transaction > ) -> Vec < PackageTemplate > {
1604
1604
let mut claimable_outpoints = Vec :: new ( ) ;
1605
1605
if let Some ( htlc_outputs) = self . counterparty_claimable_outpoints . get ( & commitment_txid) {
1606
1606
if let Some ( revocation_points) = self . their_cur_revocation_points {
@@ -1627,7 +1627,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1627
1627
if preimage. is_some ( ) || !htlc. offered {
1628
1628
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 ( ) ) ;
1629
1629
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 ) ;
1630
- claimable_outpoints. push ( OnchainRequest { content : counterparty_package } ) ;
1630
+ claimable_outpoints. push ( counterparty_package) ;
1631
1631
}
1632
1632
}
1633
1633
}
@@ -1638,7 +1638,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1638
1638
}
1639
1639
1640
1640
/// Attempts to claim a counterparty HTLC-Success/HTLC-Timeout's outputs using the revocation key
1641
- fn check_spend_counterparty_htlc < L : Deref > ( & mut self , tx : & Transaction , commitment_number : u64 , height : u32 , logger : & L ) -> ( Vec < OnchainRequest > , Option < ( Txid , Vec < ( u32 , TxOut ) > ) > ) where L :: Target : Logger {
1641
+ fn check_spend_counterparty_htlc < L : Deref > ( & mut self , tx : & Transaction , commitment_number : u64 , height : u32 , logger : & L ) -> ( Vec < PackageTemplate > , Option < ( Txid , Vec < ( u32 , TxOut ) > ) > ) where L :: Target : Logger {
1642
1642
let htlc_txid = tx. txid ( ) ;
1643
1643
if tx. input . len ( ) != 1 || tx. output . len ( ) != 1 || tx. input [ 0 ] . witness . len ( ) != 5 {
1644
1644
return ( Vec :: new ( ) , None )
@@ -1660,15 +1660,15 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1660
1660
log_trace ! ( logger, "Counterparty HTLC broadcast {}:{}" , htlc_txid, 0 ) ;
1661
1661
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 ) ;
1662
1662
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) ;
1663
- let claimable_outpoints = vec ! ( OnchainRequest { content : justice_package } ) ;
1663
+ let claimable_outpoints = vec ! ( justice_package) ;
1664
1664
let outputs = vec ! [ ( 0 , tx. output[ 0 ] . clone( ) ) ] ;
1665
1665
( claimable_outpoints, Some ( ( htlc_txid, outputs) ) )
1666
1666
}
1667
1667
1668
- // Returns (1) `OnchainRequest `s that can be given to the OnChainTxHandler, so that the handler can
1668
+ // Returns (1) `PackageTemplate `s that can be given to the OnChainTxHandler, so that the handler can
1669
1669
// broadcast transactions claiming holder HTLC commitment outputs and (2) a holder revokable
1670
1670
// script so we can detect whether a holder transaction has been seen on-chain.
1671
- fn get_broadcasted_holder_claims ( & self , holder_tx : & HolderSignedTx , height : u32 ) -> ( Vec < OnchainRequest > , Option < ( Script , PublicKey , PublicKey ) > ) {
1671
+ fn get_broadcasted_holder_claims ( & self , holder_tx : & HolderSignedTx , height : u32 ) -> ( Vec < PackageTemplate > , Option < ( Script , PublicKey , PublicKey ) > ) {
1672
1672
let mut claim_requests = Vec :: with_capacity ( holder_tx. htlc_outputs . len ( ) ) ;
1673
1673
1674
1674
let redeemscript = chan_utils:: get_revokeable_redeemscript ( & holder_tx. revocation_key , self . on_holder_tx_csv , & holder_tx. delayed_payment_key ) ;
@@ -1685,7 +1685,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1685
1685
}
1686
1686
} else { None } , htlc. amount_msat ) ;
1687
1687
let htlc_package = PackageTemplate :: build_package ( holder_tx. txid , transaction_output_index, PackageSolvingData :: HolderHTLCOutput ( htlc_output) , PackageMalleability :: Untractable , height, false , 0 , None , height) ;
1688
- claim_requests. push ( OnchainRequest { content : htlc_package } ) ;
1688
+ claim_requests. push ( htlc_package) ;
1689
1689
}
1690
1690
}
1691
1691
@@ -1706,7 +1706,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1706
1706
/// Attempts to claim any claimable HTLCs in a commitment transaction which was not (yet)
1707
1707
/// revoked using data in holder_claimable_outpoints.
1708
1708
/// Should not be used if check_spend_revoked_transaction succeeds.
1709
- fn check_spend_holder_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < OnchainRequest > , ( Txid , Vec < ( u32 , TxOut ) > ) ) where L :: Target : Logger {
1709
+ fn check_spend_holder_transaction < L : Deref > ( & mut self , tx : & Transaction , height : u32 , logger : & L ) -> ( Vec < PackageTemplate > , ( Txid , Vec < ( u32 , TxOut ) > ) ) where L :: Target : Logger {
1710
1710
let commitment_txid = tx. txid ( ) ;
1711
1711
let mut claim_requests = Vec :: new ( ) ;
1712
1712
let mut watch_outputs = Vec :: new ( ) ;
@@ -1894,7 +1894,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1894
1894
if should_broadcast {
1895
1895
let funding_outp = HolderFundingOutput :: build ( self . funding_redeemscript . clone ( ) ) ;
1896
1896
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) ;
1897
- claimable_outpoints. push ( OnchainRequest { content : commitment_package } ) ;
1897
+ claimable_outpoints. push ( commitment_package) ;
1898
1898
}
1899
1899
if should_broadcast {
1900
1900
self . pending_monitor_events . push ( MonitorEvent :: CommitmentTxBroadcasted ( self . funding_info . 0 ) ) ;
0 commit comments