mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
0b3c3e8406
* Merge #11415: [RPC] Disallow using addresses in createmultisig
1df206f
Disallow using addresses in createmultisig (Andrew Chow)
Pull request description:
This PR should be the last part of #7965.
This PR makes createmultisig only accept public keys and marks the old functionality of accepting addresses as deprecated.
It also splits `_createmultisig_redeemscript` into two functions, `_createmultisig_getpubkeys` and `_createmultisig_getaddr_pubkeys`. `_createmultisig_getpubkeys` retrieves public keys from the RPC parameters and `_createmultisig_getaddr_pubkeys` retrieves addresses' public keys from the wallet. `_createmultisig_getaddr_pubkeys` requires the wallet and is only used by `addwitnessaddress` (except when `createmultisig` is used in deprecated mode).
`addwitnessaddress`'s API is also changed. Instead of returning just an address, it now returns the same thing as `createmultisig`: a JSON object with two fields, address and redeemscript.
Tree-SHA512: a5796e41935ad5e47d8165ff996a8b20d5112b5fc1a06a6d3c7f5513c13e7628a4fd37ec30fde05d8b15abfed51bc250710140f6834b13f64d0a0e47a3817969
* fix backport
Signed-off-by: pasta <pasta@dashboost.org>
* fix backport
Signed-off-by: pasta <pasta@dashboost.org>
* fix backport
Signed-off-by: pasta <pasta@dashboost.org>
* Dashify
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
28 lines
1.2 KiB
Python
Executable File
28 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2017 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test deprecation of RPC calls."""
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import assert_raises_rpc_error
|
|
|
|
class DeprecatedRpcTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.num_nodes = 2
|
|
self.setup_clean_chain = True
|
|
self.extra_args = [[], ["-deprecatedrpc=estimatefee", "-deprecatedrpc=createmultisig"]]
|
|
|
|
def run_test(self):
|
|
self.log.info("estimatefee: Shows deprecated message")
|
|
assert_raises_rpc_error(-32, 'estimatefee is deprecated', self.nodes[0].estimatefee, 1)
|
|
|
|
self.log.info("Using -deprecatedrpc=estimatefee bypasses the error")
|
|
self.nodes[1].estimatefee(1)
|
|
|
|
self.log.info("Make sure that -deprecatedrpc=createmultisig allows it to take addresses")
|
|
assert_raises_rpc_error(-5, "Invalid public key", self.nodes[0].createmultisig, 1, [self.nodes[0].getnewaddress()])
|
|
self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()])
|
|
|
|
if __name__ == '__main__':
|
|
DeprecatedRpcTest().main()
|