15
15
16
16
BUFFER_SIZE = 16 * 1024
17
17
18
+
18
19
class ToolWalletTest (BitcoinTestFramework ):
19
20
def set_test_params (self ):
20
21
self .num_nodes = 1
@@ -48,7 +49,7 @@ def wallet_shasum(self):
48
49
h = hashlib .sha1 ()
49
50
mv = memoryview (bytearray (BUFFER_SIZE ))
50
51
with open (self .wallet_path , 'rb' , buffering = 0 ) as f :
51
- for n in iter (lambda : f .readinto (mv ), 0 ):
52
+ for n in iter (lambda : f .readinto (mv ), 0 ):
52
53
h .update (mv [:n ])
53
54
return h .hexdigest ()
54
55
@@ -69,7 +70,12 @@ def test_invalid_tool_commands_and_args(self):
69
70
self .assert_raises_tool_error ('Invalid command: help' , 'help' )
70
71
self .assert_raises_tool_error ('Error: two methods provided (info and create). Only one method should be provided.' , 'info' , 'create' )
71
72
self .assert_raises_tool_error ('Error parsing command line arguments: Invalid parameter -foo' , '-foo' )
72
- self .assert_raises_tool_error ('Error loading wallet.dat. Is wallet being used by other process?' , '-wallet=wallet.dat' , 'info' )
73
+ self .assert_raises_tool_error (
74
+ 'Error initializing wallet database environment "{}"!\n Error loading wallet.dat. Is wallet being used by other process?'
75
+ .format (os .path .join (self .nodes [0 ].datadir , self .chain , 'wallets' )),
76
+ '-wallet=wallet.dat' ,
77
+ 'info' ,
78
+ )
73
79
self .assert_raises_tool_error ('Error: no wallet file at nonexistent.dat' , '-wallet=nonexistent.dat' , 'info' )
74
80
75
81
def test_tool_wallet_info (self ):
@@ -84,7 +90,7 @@ def test_tool_wallet_info(self):
84
90
#
85
91
# self.log.debug('Setting wallet file permissions to 400 (read-only)')
86
92
# os.chmod(self.wallet_path, stat.S_IRUSR)
87
- # assert( self.wallet_permissions() in ['400', '666']) # Sanity check. 666 because Appveyor.
93
+ # assert self.wallet_permissions() in ['400', '666'] # Sanity check. 666 because Appveyor.
88
94
# shasum_before = self.wallet_shasum()
89
95
timestamp_before = self .wallet_timestamp ()
90
96
self .log .debug ('Wallet file timestamp before calling info: {}' .format (timestamp_before ))
@@ -103,7 +109,7 @@ def test_tool_wallet_info(self):
103
109
self .log_wallet_timestamp_comparison (timestamp_before , timestamp_after )
104
110
self .log .debug ('Setting wallet file permissions back to 600 (read/write)' )
105
111
os .chmod (self .wallet_path , stat .S_IRUSR | stat .S_IWUSR )
106
- assert ( self .wallet_permissions () in ['600' , '666' ]) # Sanity check. 666 because Appveyor.
112
+ assert self .wallet_permissions () in ['600' , '666' ] # Sanity check. 666 because Appveyor.
107
113
#
108
114
# TODO: Wallet tool info should not write to the wallet file.
109
115
# The following lines should be uncommented and the tests still succeed:
0 commit comments