9
9
except ImportError :
10
10
pass
11
11
12
- import concurrent .futures
13
-
14
12
from test_framework .blocktools import COINBASE_MATURITY
15
- from test_framework .descriptors import descsum_create
16
13
from test_framework .test_framework import BitcoinTestFramework
17
14
from test_framework .util import (
18
15
assert_not_equal ,
@@ -33,41 +30,6 @@ def skip_test_if_missing_module(self):
33
30
self .skip_if_no_wallet ()
34
31
self .skip_if_no_py_sqlite3 ()
35
32
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
-
71
33
def run_test (self ):
72
34
# Make a descriptor wallet
73
35
self .log .info ("Making a descriptor wallet" )
@@ -254,8 +216,6 @@ def run_test(self):
254
216
conn .close ()
255
217
assert_raises_rpc_error (- 4 , "Unexpected legacy entry in descriptor wallet found." , self .nodes [0 ].loadwallet , "crashme" )
256
218
257
- self .test_concurrent_writes ()
258
-
259
219
260
220
if __name__ == '__main__' :
261
221
WalletDescriptorTest (__file__ ).main ()
0 commit comments