@@ -1201,23 +1201,21 @@ impl SharedOwnedOutput {
12011201pub ( super ) enum OutputOwned {
12021202 /// Belongs to a single party -- controlled exclusively and fully belonging to a single party
12031203 Single ( TxOut ) ,
1204- /// Output with shared control, but fully belonging to local node
1205- SharedControlFullyOwned ( TxOut ) ,
1206- /// Output with shared control and joint ownership
1204+ /// Output with shared control and value split between the two ends (or fully at one side)
12071205 Shared ( SharedOwnedOutput ) ,
12081206}
12091207
12101208impl OutputOwned {
12111209 pub fn tx_out ( & self ) -> & TxOut {
12121210 match self {
1213- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out ) => tx_out,
1211+ OutputOwned :: Single ( tx_out) => tx_out,
12141212 OutputOwned :: Shared ( output) => & output. tx_out ,
12151213 }
12161214 }
12171215
12181216 fn into_tx_out ( self ) -> TxOut {
12191217 match self {
1220- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out ) => tx_out,
1218+ OutputOwned :: Single ( tx_out) => tx_out,
12211219 OutputOwned :: Shared ( output) => output. tx_out ,
12221220 }
12231221 }
@@ -1229,30 +1227,25 @@ impl OutputOwned {
12291227 fn is_shared ( & self ) -> bool {
12301228 match self {
12311229 OutputOwned :: Single ( _) => false ,
1232- OutputOwned :: SharedControlFullyOwned ( _) => true ,
12331230 OutputOwned :: Shared ( _) => true ,
12341231 }
12351232 }
12361233
12371234 fn local_value ( & self , local_role : AddingRole ) -> u64 {
12381235 match self {
1239- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out) => {
1240- match local_role {
1241- AddingRole :: Local => tx_out. value . to_sat ( ) ,
1242- AddingRole :: Remote => 0 ,
1243- }
1236+ OutputOwned :: Single ( tx_out) => match local_role {
1237+ AddingRole :: Local => tx_out. value . to_sat ( ) ,
1238+ AddingRole :: Remote => 0 ,
12441239 } ,
12451240 OutputOwned :: Shared ( output) => output. local_owned ,
12461241 }
12471242 }
12481243
12491244 fn remote_value ( & self , local_role : AddingRole ) -> u64 {
12501245 match self {
1251- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out) => {
1252- match local_role {
1253- AddingRole :: Local => 0 ,
1254- AddingRole :: Remote => tx_out. value . to_sat ( ) ,
1255- }
1246+ OutputOwned :: Single ( tx_out) => match local_role {
1247+ AddingRole :: Local => 0 ,
1248+ AddingRole :: Remote => tx_out. value . to_sat ( ) ,
12561249 } ,
12571250 OutputOwned :: Shared ( output) => output. remote_owned ( ) ,
12581251 }
@@ -1516,12 +1509,9 @@ impl InteractiveTxConstructor {
15161509 for output in & outputs_to_contribute {
15171510 let new_output = match output {
15181511 OutputOwned :: Single ( _tx_out) => None ,
1519- OutputOwned :: SharedControlFullyOwned ( tx_out) => {
1520- Some ( ( tx_out. script_pubkey . clone ( ) , tx_out. value . to_sat ( ) ) )
1521- } ,
15221512 OutputOwned :: Shared ( output) => {
15231513 // Sanity check
1524- if output. local_owned >= output. tx_out . value . to_sat ( ) {
1514+ if output. local_owned > output. tx_out . value . to_sat ( ) {
15251515 return Err ( AbortReason :: InvalidLowFundingOutputValue ) ;
15261516 }
15271517 Some ( ( output. tx_out . script_pubkey . clone ( ) , output. local_owned ) )
@@ -2138,7 +2128,9 @@ mod tests {
21382128
21392129 /// Generate a single output that is the funding output
21402130 fn generate_output ( output : & TestOutput ) -> Vec < OutputOwned > {
2141- vec ! [ OutputOwned :: SharedControlFullyOwned ( generate_txout( output) ) ]
2131+ let txout = generate_txout ( output) ;
2132+ let value = txout. value . to_sat ( ) ;
2133+ vec ! [ OutputOwned :: Shared ( SharedOwnedOutput :: new( txout, value) ) ]
21422134 }
21432135
21442136 /// Generate a single P2WSH output that is the funding output
@@ -2707,7 +2699,8 @@ mod tests {
27072699 . collect :: < Vec < ( TxIn , TransactionU16LenLimited ) > > ( ) ;
27082700 let our_contributed = 110_000 ;
27092701 let txout = TxOut { value : Amount :: from_sat ( 128_000 ) , script_pubkey : ScriptBuf :: new ( ) } ;
2710- let outputs = vec ! [ OutputOwned :: SharedControlFullyOwned ( txout) ] ;
2702+ let value = txout. value . to_sat ( ) ;
2703+ let outputs = vec ! [ OutputOwned :: Shared ( SharedOwnedOutput :: new( txout, value) ) ] ;
27112704 let funding_feerate_sat_per_1000_weight = 3000 ;
27122705
27132706 let total_inputs: u64 = input_prevouts. iter ( ) . map ( |o| o. value . to_sat ( ) ) . sum ( ) ;
0 commit comments