@@ -92,6 +92,7 @@ def test_WalletManager(
9292
9393
9494@pytest .mark .slow
95+ @pytest .mark .bottleneck
9596def test_WalletManager_2_nodes (
9697 docker ,
9798 request ,
@@ -142,92 +143,6 @@ def test_WalletManager_2_nodes(
142143 wm .update (chain = "regtest3" )
143144 with pytest .raises (Exception , match = "can only be changed with one another" ) as e :
144145 wm .update (rpc = bitcoin_regtest2 .get_rpc ())
145- # assert False
146-
147-
148- @pytest .mark .slow
149- def test_wallet_createpsbt (
150- docker , request , devices_filled_data_folder , device_manager , bitcoin_regtest
151- ):
152- wm = WalletManager (
153- 200100 ,
154- devices_filled_data_folder ,
155- bitcoin_regtest .get_rpc (),
156- "regtest" ,
157- device_manager ,
158- allow_threading = False ,
159- )
160- # A wallet-creation needs a device
161- device = device_manager .get_by_alias ("specter" )
162- key = Key .from_json (
163- {
164- "derivation" : "m/48h/1h/0h/2h" ,
165- "original" : "Vpub5n9kKePTPPGtw3RddeJWJe29epEyBBcoHbbPi5HhpoG2kTVsSCUzsad33RJUt3LktEUUPPofcZczuudnwR7ZgkAkT6N2K2Z7wdyjYrVAkXM" ,
166- "fingerprint" : "08686ac6" ,
167- "type" : "wsh" ,
168- "xpub" : "tpubDFHpKypXq4kwUrqLotPs6fCic5bFqTRGMBaTi9s5YwwGymE8FLGwB2kDXALxqvNwFxB1dLWYBmmeFVjmUSdt2AsaQuPmkyPLBKRZW8BGCiL" ,
169- }
170- )
171- wallet = wm .create_wallet ("a_second_test_wallet" , 1 , "wpkh" , [key ], [device ])
172- # Let's fund the wallet
173- address = wallet .getnewaddress ()
174- assert address == "bcrt1qtnrv2jpygx2ef3zqfjhqplnycxak2m6ljnhq6z"
175- bitcoin_regtest .testcoin_faucet (address , amount = 5 )
176- address = wallet .getnewaddress ()
177- bitcoin_regtest .testcoin_faucet (address , amount = 10 )
178- address = wallet .getnewaddress ()
179- bitcoin_regtest .testcoin_faucet (address , amount = 15 )
180- # update the wallet data
181- wallet .update_balance ()
182- assert wallet .amount_total == 30
183- unspents = wallet .rpc .listunspent (0 )
184- # Let's take 3 UTXO:
185- selected_coins = [
186- {"txid" : u ["txid" ], "vout" : u ["vout" ]}
187- for u in [unspents [0 ], unspents [1 ], unspents [2 ]]
188- ]
189- selected_coins_amount_sum = (
190- unspents [0 ]["amount" ] + unspents [1 ]["amount" ] + unspents [2 ]["amount" ]
191- )
192- number_of_coins_to_spend = (
193- selected_coins_amount_sum - 0.1
194- ) # Let's spend almost all of them
195- random_address = "bcrt1qwxhn49vkppudjcgrd4mylxczgjtuwayg5ckp5s"
196- psbt = wallet .createpsbt (
197- [random_address ],
198- [number_of_coins_to_spend ],
199- True ,
200- 0 ,
201- 10 ,
202- selected_coins = selected_coins ,
203- )
204- assert len (psbt ["tx" ]["vin" ]) == 3
205- psbt_txs = [tx ["txid" ] for tx in psbt ["tx" ]["vin" ]]
206- for coin in selected_coins :
207- assert coin ["txid" ] in psbt_txs
208-
209- # Now let's spend more coins than we have selected. This should result in an exception:
210- try :
211- psbt = wallet .createpsbt (
212- [random_address ],
213- [number_of_coins_to_spend + 1 ],
214- True ,
215- 0 ,
216- 10 ,
217- selected_coins = selected_coins ,
218- )
219- assert False , "should throw an exception!"
220- except SpecterError as e :
221- pass
222-
223- assert wallet .amount_locked_unsigned == selected_coins_amount_sum
224- assert len (wallet .rpc .listlockunspent ()) == 3
225- assert wallet .amount_available == wallet .amount_total - selected_coins_amount_sum
226-
227- wallet .delete_pending_psbt (psbt ["tx" ]["txid" ])
228- assert wallet .amount_locked_unsigned == 0
229- assert len (wallet .rpc .listlockunspent ()) == 0
230- assert wallet .amount_total == wallet .amount_available
231146
232147
233148def test_WalletManager_check_duplicate_keys (empty_data_folder ):
@@ -779,47 +694,3 @@ def test_multisig_wallet_backup_and_restore(
779694
780695 # We restored the wallet's utxos
781696 assert wallet .amount_total == 3.3
782-
783-
784- @pytest .mark .slow
785- def test_taproot_wallet (bitcoin_regtest , caplog , specter_regtest_configured ):
786- """
787- Taproot m/86h/ derivation path xpubs should be able to create wallets and
788- receive funds
789- """
790- caplog .set_level (logging .INFO )
791-
792- device_manager = specter_regtest_configured .device_manager
793- wallet_manager = specter_regtest_configured .wallet_manager
794-
795- taproot_device = device_manager .add_device (
796- name = "hot_key" , device_type = DeviceTypes .BITCOINCORE , keys = []
797- )
798- taproot_device .setup_device (file_password = None , wallet_manager = wallet_manager )
799- taproot_device .add_hot_wallet_keys (
800- mnemonic = generate_mnemonic (strength = 128 ),
801- passphrase = "" ,
802- paths = ["m/86h/1h/0h" ], # Taproot for testnet/regtest
803- file_password = None ,
804- wallet_manager = wallet_manager ,
805- testnet = True ,
806- keys_range = [0 , 1000 ],
807- keys_purposes = [],
808- )
809-
810- taproot_wallet = wallet_manager .create_wallet (
811- name = "my_taproot_test_wallet" ,
812- sigs_required = 1 ,
813- key_type = taproot_device .keys [0 ].key_type ,
814- keys = [taproot_device .keys [0 ]],
815- devices = [taproot_device ],
816- )
817-
818- # Fund the wallet
819- address = taproot_wallet .getnewaddress ()
820- bitcoin_regtest .testcoin_faucet (address , amount = 2.2 )
821- taproot_wallet .update_balance ()
822- assert taproot_wallet .amount_total == 2.2
823-
824- # Taproot test addrs are bcrt1p vs native segwit bcrt1q
825- assert address .startswith ("bcrt1p" )
0 commit comments