@@ -1191,23 +1191,21 @@ impl SharedOwnedOutput {
11911191pub ( super ) enum OutputOwned {
11921192 /// Belongs to a single party -- controlled exclusively and fully belonging to a single party
11931193 Single ( TxOut ) ,
1194- /// Output with shared control, but fully belonging to local node
1195- SharedControlFullyOwned ( TxOut ) ,
1196- /// Output with shared control and joint ownership
1194+ /// Output with shared control and value split between the two ends (or fully at one side)
11971195 Shared ( SharedOwnedOutput ) ,
11981196}
11991197
12001198impl OutputOwned {
12011199 pub fn tx_out ( & self ) -> & TxOut {
12021200 match self {
1203- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out ) => tx_out,
1201+ OutputOwned :: Single ( tx_out) => tx_out,
12041202 OutputOwned :: Shared ( output) => & output. tx_out ,
12051203 }
12061204 }
12071205
12081206 fn into_tx_out ( self ) -> TxOut {
12091207 match self {
1210- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out ) => tx_out,
1208+ OutputOwned :: Single ( tx_out) => tx_out,
12111209 OutputOwned :: Shared ( output) => output. tx_out ,
12121210 }
12131211 }
@@ -1219,30 +1217,25 @@ impl OutputOwned {
12191217 fn is_shared ( & self ) -> bool {
12201218 match self {
12211219 OutputOwned :: Single ( _) => false ,
1222- OutputOwned :: SharedControlFullyOwned ( _) => true ,
12231220 OutputOwned :: Shared ( _) => true ,
12241221 }
12251222 }
12261223
12271224 fn local_value ( & self , local_role : AddingRole ) -> u64 {
12281225 match self {
1229- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out) => {
1230- match local_role {
1231- AddingRole :: Local => tx_out. value . to_sat ( ) ,
1232- AddingRole :: Remote => 0 ,
1233- }
1226+ OutputOwned :: Single ( tx_out) => match local_role {
1227+ AddingRole :: Local => tx_out. value . to_sat ( ) ,
1228+ AddingRole :: Remote => 0 ,
12341229 } ,
12351230 OutputOwned :: Shared ( output) => output. local_owned ,
12361231 }
12371232 }
12381233
12391234 fn remote_value ( & self , local_role : AddingRole ) -> u64 {
12401235 match self {
1241- OutputOwned :: Single ( tx_out) | OutputOwned :: SharedControlFullyOwned ( tx_out) => {
1242- match local_role {
1243- AddingRole :: Local => 0 ,
1244- AddingRole :: Remote => tx_out. value . to_sat ( ) ,
1245- }
1236+ OutputOwned :: Single ( tx_out) => match local_role {
1237+ AddingRole :: Local => 0 ,
1238+ AddingRole :: Remote => tx_out. value . to_sat ( ) ,
12461239 } ,
12471240 OutputOwned :: Shared ( output) => output. remote_owned ( ) ,
12481241 }
@@ -1506,12 +1499,9 @@ impl InteractiveTxConstructor {
15061499 for output in & outputs_to_contribute {
15071500 let new_output = match output {
15081501 OutputOwned :: Single ( _tx_out) => None ,
1509- OutputOwned :: SharedControlFullyOwned ( tx_out) => {
1510- Some ( ( tx_out. script_pubkey . clone ( ) , tx_out. value . to_sat ( ) ) )
1511- } ,
15121502 OutputOwned :: Shared ( output) => {
15131503 // Sanity check
1514- if output. local_owned >= output. tx_out . value . to_sat ( ) {
1504+ if output. local_owned > output. tx_out . value . to_sat ( ) {
15151505 return Err ( AbortReason :: InvalidLowFundingOutputValue ) ;
15161506 }
15171507 Some ( ( output. tx_out . script_pubkey . clone ( ) , output. local_owned ) )
@@ -2128,7 +2118,9 @@ mod tests {
21282118
21292119 /// Generate a single output that is the funding output
21302120 fn generate_output ( output : & TestOutput ) -> Vec < OutputOwned > {
2131- vec ! [ OutputOwned :: SharedControlFullyOwned ( generate_txout( output) ) ]
2121+ let txout = generate_txout ( output) ;
2122+ let value = txout. value . to_sat ( ) ;
2123+ vec ! [ OutputOwned :: Shared ( SharedOwnedOutput :: new( txout, value) ) ]
21322124 }
21332125
21342126 /// Generate a single P2WSH output that is the funding output
@@ -2697,7 +2689,8 @@ mod tests {
26972689 . collect :: < Vec < ( TxIn , TransactionU16LenLimited ) > > ( ) ;
26982690 let our_contributed = 110_000 ;
26992691 let txout = TxOut { value : Amount :: from_sat ( 128_000 ) , script_pubkey : ScriptBuf :: new ( ) } ;
2700- let outputs = vec ! [ OutputOwned :: SharedControlFullyOwned ( txout) ] ;
2692+ let value = txout. value . to_sat ( ) ;
2693+ let outputs = vec ! [ OutputOwned :: Shared ( SharedOwnedOutput :: new( txout, value) ) ] ;
27012694 let funding_feerate_sat_per_1000_weight = 3000 ;
27022695
27032696 let total_inputs: u64 = input_prevouts. iter ( ) . map ( |o| o. value . to_sat ( ) ) . sum ( ) ;
0 commit comments