99except ImportError :
1010 pass
1111
12- import concurrent .futures
13-
1412from test_framework .blocktools import COINBASE_MATURITY
15- from test_framework .descriptors import descsum_create
1613from test_framework .test_framework import BitcoinTestFramework
1714from test_framework .util import (
1815 assert_not_equal ,
@@ -33,41 +30,6 @@ def skip_test_if_missing_module(self):
3330 self .skip_if_no_wallet ()
3431 self .skip_if_no_py_sqlite3 ()
3532
36- def test_concurrent_writes (self ):
37- self .log .info ("Test sqlite concurrent writes are in the correct order" )
38- self .restart_node (0 , extra_args = ["-unsafesqlitesync=0" ])
39- self .nodes [0 ].createwallet (wallet_name = "concurrency" , blank = True )
40- wallet = self .nodes [0 ].get_wallet_rpc ("concurrency" )
41- # First import a descriptor that uses hardened dervation so that topping up
42- # Will require writing a ton to db
43- wallet .importdescriptors ([{"desc" :descsum_create ("wpkh(tprv8ZgxMBicQKsPeuVhWwi6wuMQGfPKi9Li5GtX35jVNknACgqe3CY4g5xgkfDDJcmtF7o1QnxWDRYw4H5P26PXq7sbcUkEqeR4fg3Kxp2tigg/0h/0h/*h)" ), "timestamp" : "now" , "active" : True }])
44- with concurrent .futures .ThreadPoolExecutor (max_workers = 1 ) as thread :
45- topup = thread .submit (wallet .keypoolrefill , newsize = 1000 )
46-
47- # Then while the topup is running, we need to do something that will call
48- # ChainStateFlushed which will trigger a write to the db, hopefully at the
49- # same time that the topup still has an open db transaction.
50- self .nodes [0 ].cli .gettxoutsetinfo ()
51- assert_equal (topup .result (), None )
52-
53- wallet .unloadwallet ()
54-
55- # Check that everything was written
56- wallet_db = self .nodes [0 ].wallets_path / "concurrency" / self .wallet_data_filename
57- conn = sqlite3 .connect (wallet_db )
58- with conn :
59- # Retrieve the bestblock_nomerkle record
60- bestblock_rec = conn .execute ("SELECT value FROM main WHERE hex(key) = '1262657374626C6F636B5F6E6F6D65726B6C65'" ).fetchone ()[0 ]
61- # Retrieve the number of descriptor cache records
62- # Since we store binary data, sqlite's comparison operators don't work everywhere
63- # so just retrieve all records and process them ourselves.
64- db_keys = conn .execute ("SELECT key FROM main" ).fetchall ()
65- cache_records = len ([k [0 ] for k in db_keys if b"walletdescriptorcache" in k [0 ]])
66- conn .close ()
67-
68- assert_equal (bestblock_rec [5 :37 ][::- 1 ].hex (), self .nodes [0 ].getbestblockhash ())
69- assert_equal (cache_records , 1000 )
70-
7133 def run_test (self ):
7234 # Make a descriptor wallet
7335 self .log .info ("Making a descriptor wallet" )
@@ -254,8 +216,6 @@ def run_test(self):
254216 conn .close ()
255217 assert_raises_rpc_error (- 4 , "Unexpected legacy entry in descriptor wallet found." , self .nodes [0 ].loadwallet , "crashme" )
256218
257- self .test_concurrent_writes ()
258-
259219
260220if __name__ == '__main__' :
261221 WalletDescriptorTest (__file__ ).main ()
0 commit comments