File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -164,12 +164,20 @@ impl FundingWallet {
164
164
fs:: OpenOptions :: new ( ) . read ( true ) . write ( true ) . create ( false ) . open ( wallet_path) ?;
165
165
let wallet_data = WalletData :: strict_decode ( & wallet_file) ?;
166
166
167
- let network = chain. try_into ( ) ?;
168
- if DescriptorExt :: < bitcoin:: PublicKey > :: network ( & wallet_data. descriptor ) ? != network {
167
+ let target_network = chain. try_into ( ) ?;
168
+ let wallet_network = DescriptorExt :: < bitcoin:: PublicKey > :: network ( & wallet_data. descriptor ) ?;
169
+
170
+ let is_correct_network = match ( wallet_network, target_network) {
171
+ ( Network :: Bitcoin , Network :: Bitcoin ) => true ,
172
+ ( Network :: Testnet , Network :: Testnet | Network :: Regtest | Network :: Signet ) => true ,
173
+ _ => false ,
174
+ } ;
175
+
176
+ if !is_correct_network {
169
177
return Err ( Error :: ChainMismatch ) ;
170
178
}
171
179
172
- FundingWallet :: init ( network , wallet_data, wallet_file, electrum_url)
180
+ FundingWallet :: init ( target_network , wallet_data, wallet_file, electrum_url)
173
181
}
174
182
175
183
fn init (
You can’t perform that action at this time.
0 commit comments