File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -3081,7 +3081,7 @@ impl Channel {
3081
3081
htlc_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , & self . local_keys . htlc_base_key ) ,
3082
3082
first_per_commitment_point : PublicKey :: from_secret_key ( & self . secp_ctx , & local_commitment_secret) ,
3083
3083
channel_flags : if self . config . announced_channel { 1 } else { 0 } ,
3084
- shutdown_scriptpubkey : OptionalField :: Absent
3084
+ shutdown_scriptpubkey : OptionalField :: Present ( if self . config . commit_upfront_shutdown_pubkey { self . get_closing_scriptpubkey ( ) } else { Builder :: new ( ) . into_script ( ) } )
3085
3085
}
3086
3086
}
3087
3087
@@ -3113,7 +3113,7 @@ impl Channel {
3113
3113
delayed_payment_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , & self . local_keys . delayed_payment_base_key ) ,
3114
3114
htlc_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , & self . local_keys . htlc_base_key ) ,
3115
3115
first_per_commitment_point : PublicKey :: from_secret_key ( & self . secp_ctx , & local_commitment_secret) ,
3116
- shutdown_scriptpubkey : OptionalField :: Absent
3116
+ shutdown_scriptpubkey : OptionalField :: Present ( if self . config . commit_upfront_shutdown_pubkey { self . get_closing_scriptpubkey ( ) } else { Builder :: new ( ) . into_script ( ) } )
3117
3117
}
3118
3118
}
3119
3119
Original file line number Diff line number Diff line change @@ -129,6 +129,14 @@ pub struct ChannelConfig {
129
129
///
130
130
/// This cannot be changed after the initial channel handshake.
131
131
pub announced_channel : bool ,
132
+ /// Set to commit to an upfront shutdown_pubkey at channel opening. In case of mutual
133
+ /// closing, the other peer will check that our closing transction output is encumbered
134
+ /// by the provided script.
135
+ ///
136
+ /// We set it by default as this ensure greater security to the user funds.
137
+ ///
138
+ /// This cannot be changed after channel opening.
139
+ pub commit_upfront_shutdown_pubkey : bool
132
140
}
133
141
134
142
impl ChannelConfig {
@@ -137,12 +145,14 @@ impl ChannelConfig {
137
145
ChannelConfig {
138
146
fee_proportional_millionths : 0 ,
139
147
announced_channel : false ,
148
+ commit_upfront_shutdown_pubkey : true ,
140
149
}
141
150
}
142
151
}
143
152
144
153
//Add write and readable traits to channelconfig
145
- impl_writeable ! ( ChannelConfig , 8 +1 , {
154
+ impl_writeable ! ( ChannelConfig , 8 +1 + 1 , {
146
155
fee_proportional_millionths,
147
- announced_channel
156
+ announced_channel,
157
+ commit_upfront_shutdown_pubkey
148
158
} ) ;
You can’t perform that action at this time.
0 commit comments