mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-29 07:18:58 +01:00
Test case for passphrases with null characters
Add a functional test to make sure the system properly accepts passphrases with null characters.
This commit is contained in:
@@ -90,6 +90,17 @@ class WalletEncryptionTest(BitcoinTestFramework):
|
|||||||
self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE + 1000)
|
self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE + 1000)
|
||||||
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
|
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
|
||||||
assert_equal(actual_time, expected_time)
|
assert_equal(actual_time, expected_time)
|
||||||
|
self.nodes[0].walletlock()
|
||||||
|
|
||||||
|
# Test passphrase with null characters
|
||||||
|
passphrase_with_nulls = "Phrase\0With\0Nulls"
|
||||||
|
self.nodes[0].walletpassphrasechange(passphrase2, passphrase_with_nulls)
|
||||||
|
# walletpassphrasechange should not stop at null characters
|
||||||
|
assert_raises_rpc_error(-14, "wallet passphrase entered was incorrect", self.nodes[0].walletpassphrase, passphrase_with_nulls.partition("\0")[0], 10)
|
||||||
|
self.nodes[0].walletpassphrase(passphrase_with_nulls, 10)
|
||||||
|
sig = self.nodes[0].signmessage(address, msg)
|
||||||
|
assert self.nodes[0].verifymessage(address, sig, msg)
|
||||||
|
self.nodes[0].walletlock()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user