@@ -97,30 +97,36 @@ pub(crate) struct RevokedOutput {
9797 weight : u64 ,
9898 amount : u64 ,
9999 on_counterparty_tx_csv : u16 ,
100+ opt_anchors : Option < ( ) > ,
101+ is_counterparty_balance : Option < ( ) > ,
100102}
101103
102104impl RevokedOutput {
103- pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : PublicKey , counterparty_htlc_base_key : PublicKey , per_commitment_key : SecretKey , amount : u64 , on_counterparty_tx_csv : u16 ) -> Self {
105+ pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : PublicKey , counterparty_htlc_base_key : PublicKey , per_commitment_key : SecretKey , amount : u64 , on_counterparty_tx_csv : u16 , opt_anchors : bool , is_counterparty_balance : bool ) -> Self {
104106 RevokedOutput {
105107 per_commitment_point,
106108 counterparty_delayed_payment_base_key,
107109 counterparty_htlc_base_key,
108110 per_commitment_key,
109111 weight : WEIGHT_REVOKED_OUTPUT ,
110112 amount,
111- on_counterparty_tx_csv
113+ on_counterparty_tx_csv,
114+ opt_anchors : if opt_anchors { Some ( ( ) ) } else { None } ,
115+ is_counterparty_balance : if is_counterparty_balance { Some ( ( ) ) } else { None } ,
112116 }
113117 }
114118}
115119
116120impl_writeable_tlv_based ! ( RevokedOutput , {
117121 ( 0 , per_commitment_point, required) ,
118122 ( 2 , counterparty_delayed_payment_base_key, required) ,
123+ ( 3 , is_counterparty_balance, option) ,
119124 ( 4 , counterparty_htlc_base_key, required) ,
120125 ( 6 , per_commitment_key, required) ,
121126 ( 8 , weight, required) ,
122127 ( 10 , amount, required) ,
123128 ( 12 , on_counterparty_tx_csv, required) ,
129+ ( 14 , opt_anchors, option) ,
124130} ) ;
125131
126132/// A struct to describe a revoked offered output and corresponding information to generate a
@@ -800,7 +806,9 @@ impl Readable for PackageTemplate {
800806 }
801807 let ( malleability, aggregable) = if let Some ( ( _, lead_input) ) = inputs. first ( ) {
802808 match lead_input {
803- PackageSolvingData :: RevokedOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
809+ PackageSolvingData :: RevokedOutput ( RevokedOutput { is_counterparty_balance : None , .. } ) => { ( PackageMalleability :: Malleable , true ) } ,
810+ PackageSolvingData :: RevokedOutput ( RevokedOutput { opt_anchors : Some ( ..) , .. } ) => { ( PackageMalleability :: Malleable , false ) } ,
811+ PackageSolvingData :: RevokedOutput ( RevokedOutput { opt_anchors : None , .. } ) => { ( PackageMalleability :: Malleable , true ) } ,
804812 PackageSolvingData :: RevokedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
805813 PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
806814 PackageSolvingData :: CounterpartyReceivedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , false ) } ,
@@ -930,7 +938,7 @@ mod tests {
930938 {
931939 let dumb_scalar = SecretKey :: from_slice( & hex:: decode( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap( ) [ ..] ) . unwrap( ) ;
932940 let dumb_point = PublicKey :: from_secret_key( & $secp_ctx, & dumb_scalar) ;
933- PackageSolvingData :: RevokedOutput ( RevokedOutput :: build( dumb_point, dumb_point, dumb_point, dumb_scalar, 0 , 0 ) )
941+ PackageSolvingData :: RevokedOutput ( RevokedOutput :: build( dumb_point, dumb_point, dumb_point, dumb_scalar, 0 , 0 , false , false ) )
934942 }
935943 }
936944 }
0 commit comments