mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-09 18:00:13 +02:00
rpc: Quote user supplied descriptor in error msg
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2018-2021 The Bitcoin Core developers
|
// Copyright (c) 2018-2022 The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@ -1222,7 +1222,7 @@ std::unique_ptr<DescriptorImpl> ParseScript(uint32_t& key_exp_index, Span<const
|
|||||||
error = "A function is needed within P2WSH";
|
error = "A function is needed within P2WSH";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
error = strprintf("%s is not a valid descriptor function", std::string(expr.begin(), expr.end()));
|
error = strprintf("'%s' is not a valid descriptor function", std::string(expr.begin(), expr.end()));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2019-2020 The Bitcoin Core developers
|
# Copyright (c) 2019-2022 The Bitcoin Core developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test getdescriptorinfo RPC.
|
"""Test getdescriptorinfo RPC.
|
||||||
@ -30,7 +30,7 @@ class DescriptorTest(BitcoinTestFramework):
|
|||||||
def run_test(self):
|
def run_test(self):
|
||||||
assert_raises_rpc_error(-1, 'getdescriptorinfo', self.nodes[0].getdescriptorinfo)
|
assert_raises_rpc_error(-1, 'getdescriptorinfo', self.nodes[0].getdescriptorinfo)
|
||||||
assert_raises_rpc_error(-3, 'Expected type string', self.nodes[0].getdescriptorinfo, 1)
|
assert_raises_rpc_error(-3, 'Expected type string', self.nodes[0].getdescriptorinfo, 1)
|
||||||
assert_raises_rpc_error(-5, 'is not a valid descriptor function', self.nodes[0].getdescriptorinfo, '')
|
assert_raises_rpc_error(-5, "'' is not a valid descriptor function", self.nodes[0].getdescriptorinfo, "")
|
||||||
|
|
||||||
# P2PK output with the specified public key.
|
# P2PK output with the specified public key.
|
||||||
self.test_desc('pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)', isrange=False, issolvable=True, hasprivatekeys=False)
|
self.test_desc('pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)', isrange=False, issolvable=True, hasprivatekeys=False)
|
||||||
|
Reference in New Issue
Block a user