Skip to content

Commit 4b1205b

Browse files
committed
Test case for passphrases with null characters
Add a functional test to make sure the system properly accepts passphrases with null characters.
1 parent 00a0861 commit 4b1205b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/functional/wallet_encryption.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ def run_test(self):
9090
self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE + 1000)
9191
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
9292
assert_equal(actual_time, expected_time)
93+
self.nodes[0].walletlock()
94+
95+
# Test passphrase with null characters
96+
passphrase_with_nulls = "Phrase\0With\0Nulls"
97+
self.nodes[0].walletpassphrasechange(passphrase2, passphrase_with_nulls)
98+
# walletpassphrasechange should not stop at null characters
99+
assert_raises_rpc_error(-14, "wallet passphrase entered was incorrect", self.nodes[0].walletpassphrase, passphrase_with_nulls.partition("\0")[0], 10)
100+
self.nodes[0].walletpassphrase(passphrase_with_nulls, 10)
101+
sig = self.nodes[0].signmessage(address, msg)
102+
assert self.nodes[0].verifymessage(address, sig, msg)
103+
self.nodes[0].walletlock()
93104

94105

95106
if __name__ == '__main__':

0 commit comments

Comments
 (0)