aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-03-24 11:54:00 +0800
committerfanquake <fanquake@gmail.com>2021-03-24 11:54:06 +0800
commita30fd40735eb5646dd4bf3c78d1532fde14502b6 (patch)
treefc33ccd4c6b06486322b9f486f732838ba93e42e /test
parent1bad33f952ead58d6048392f64082b91ced14f0d (diff)
parent5a2d98c640cf308d3c7e85ba51fbb7e84f99322a (diff)
downloadbitcoin-a30fd40735eb5646dd4bf3c78d1532fde14502b6.tar.xz
Merge #20901: [0.21.1]: rc1 Backports
5a2d98c640cf308d3c7e85ba51fbb7e84f99322a doc: Remove outdated comment (Hennadii Stepanov) 8426e3a8a1aad2e1ea794158ffb9a587f476d8d3 fuzz: Bump FuzzedDataProvider.h (MarcoFalke) 14e3f2a1c916fccf375a6570e58072c4d007fc3c fuzz: Bump FuzzedDataProvider.h (MarcoFalke) a48c9d31610cab3ddd4f7334e83db5cf4f184df1 fuzz: Update FuzzedDataProvider.h from upstream (LLVM) (practicalswift) 6746cd078be8a15c69f8f5ba5253b1768d0acf21 doc: add signet to doc/bitcoin-conf.md (Jon Atack) 58975d5c0abeab8cb66f6006ee558d4bb7cc12b5 doc: add signet to share/examples/bitcoin.conf (Jon Atack) b35711efdebc4e95906b1e809e711bc707852f2d Update vcpkg checkout commit. (Aaron Clauson) 3a126724195fcf00d84e852a9247475fccd14f38 GUI: Write PSBTs to file with binary mode (Andrew Chow) 36ecf5eb8752890fdffd617c9fedb08033607f99 tests: Test that a fully signed tx given to signrawtx is unchanged (Andrew Chow) 4ef1e4bd407ccf80b2a1d40e946e2ac832e624e5 test: disallow sendtoaddress/sendmany when private keys disabled (Jon Atack) d6b5eb5fcc8e8f7f0ab778f32d49aabf6e04d80d Disallow sendtoaddress and sendmany when private keys disabled (Andrew Chow) 08dada84565ea5f49127123e356c82a150626f3c util: Disallow negative mocktime (MarcoFalke) 95218ee95cdb4046ee7d622eac822e74d94314c7 net: Avoid UBSan warning in ProcessMessage(...) (practicalswift) 4607019798c543f046bcd22d5b7c09750e7e0ee2 fix the unreachable code at feature_taproot (Bruno Garcia) 6dc58e99457fe4609fa3c401e89f98c92dbd9878 qt: Use "fusion" style on macOS Big Sur with old Qt (Hennadii Stepanov) e2ebc8567a96e92d1c039b2e7c5f48826fece810 raise helpMessageDialog (randymcmillan) a98f211940dc6eaed8050263efad7656126b7b3e Fix MSVC build after gui#176 (Hennadii Stepanov) bdc64c9030488e7a6b88f369fb876c0b21c04a25 qt: Stop the effect of hidden widgets on the size of QStackedWidget (Hennadii Stepanov) 7bc4498234e16bc75975555cbe7855384489782f qt: Fix TxViewDelegate layout (Hennadii Stepanov) b7086e69ff3825c3f3bfde4ca9af90663a4575dd qt: Add TransactionOverviewWidget class (Hennadii Stepanov) 0dba346a568882434098dd08566978e23eb4a516 qt: Use layout manager for Create Wallet dialog (Hennadii Stepanov) 7bf3ed495b96f0959d5c45c6e1936d8628dec730 Bugfix: GUI: Restore SendConfirmationDialog button default to "Yes" (Luke Dashjr) bdce029191ab094a4a325b143324487f1c62ba7c test: add test for banning of non-IP addresses (Vasil Dimov) c33fbab25c82b6a18773b80e8b355c987066ae5a net: allow CSubNet of non-IP networks (Vasil Dimov) Pull request description: Current backports for *0.21.1*. One conflict was in the test case. ACKs for top commit: ajtowns: ACK 5a2d98c640cf308d3c7e85ba51fbb7e84f99322a -- checked 'rebased-from' patches are in master, and rebased patches are clean rebases (except for the first one which changes `""s` to `std::string("")` to avoid c++17 dependency). commits seem fine, but haven't reviewed in detail. fanquake: ACK 5a2d98c640cf308d3c7e85ba51fbb7e84f99322a - branched off `0.21` and redid the backports. Minor conflict in c33fbab25c82b6a18773b80e8b355c987066ae5a. The diff between my branch and #20901 was just in release notes, `_CLIENT_VERSION_RC` (#20901 branched before 95ea54ba089610019a74c1176a2c7c0dba144b1c) and #21490 which has already been merged into `0.21`. Tree-SHA512: 75d16d3cf9066a45759758b8185dc3b9dad6a6102c2ac9921f758a310e48d5d3122f0dafa515df42475235fc66a42cc04dd156ee1e61c86a1238bd11707642ea
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_taproot.py1
-rwxr-xr-xtest/functional/rpc_setban.py16
-rwxr-xr-xtest/functional/rpc_signrawtransaction.py14
-rwxr-xr-xtest/functional/rpc_uptime.py5
-rwxr-xr-xtest/functional/wallet_watchonly.py7
5 files changed, 41 insertions, 2 deletions
diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py
index 0f0fe8a34a..2b9b614878 100755
--- a/test/functional/feature_taproot.py
+++ b/test/functional/feature_taproot.py
@@ -515,7 +515,6 @@ def add_spender(spenders, *args, **kwargs):
def random_checksig_style(pubkey):
"""Creates a random CHECKSIG* tapscript that would succeed with only the valid signature on witness stack."""
- return bytes(CScript([pubkey, OP_CHECKSIG]))
opcode = random.choice([OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKSIGADD])
if (opcode == OP_CHECKSIGVERIFY):
ret = CScript([pubkey, opcode, OP_1])
diff --git a/test/functional/rpc_setban.py b/test/functional/rpc_setban.py
index bc48449084..551eb4d724 100755
--- a/test/functional/rpc_setban.py
+++ b/test/functional/rpc_setban.py
@@ -15,6 +15,9 @@ class SetBanTests(BitcoinTestFramework):
self.setup_clean_chain = True
self.extra_args = [[],[]]
+ def is_banned(self, node, addr):
+ return any(e['address'] == addr for e in node.listbanned())
+
def run_test(self):
# Node 0 connects to Node 1, check that the noban permission is not granted
self.connect_nodes(0, 1)
@@ -42,5 +45,18 @@ class SetBanTests(BitcoinTestFramework):
peerinfo = self.nodes[1].getpeerinfo()[0]
assert(not 'noban' in peerinfo['permissions'])
+ self.log.info("Test that a non-IP address can be banned/unbanned")
+ node = self.nodes[1]
+ tor_addr = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion"
+ ip_addr = "1.2.3.4"
+ assert(not self.is_banned(node, tor_addr))
+ assert(not self.is_banned(node, ip_addr))
+ node.setban(tor_addr, "add")
+ assert(self.is_banned(node, tor_addr))
+ assert(not self.is_banned(node, ip_addr))
+ node.setban(tor_addr, "remove")
+ assert(not self.is_banned(self.nodes[1], tor_addr))
+ assert(not self.is_banned(node, ip_addr))
+
if __name__ == '__main__':
SetBanTests().main()
diff --git a/test/functional/rpc_signrawtransaction.py b/test/functional/rpc_signrawtransaction.py
index b962e1c3a5..2fbbdbbdf0 100755
--- a/test/functional/rpc_signrawtransaction.py
+++ b/test/functional/rpc_signrawtransaction.py
@@ -151,6 +151,19 @@ class SignRawTransactionsTest(BitcoinTestFramework):
assert_equal(rawTxSigned['errors'][1]['witness'], ["304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee01", "025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357"])
assert not rawTxSigned['errors'][0]['witness']
+ def test_fully_signed_tx(self):
+ self.log.info("Test signing a fully signed transaction does nothing")
+ self.nodes[0].walletpassphrase("password", 9999)
+ self.nodes[0].generate(101)
+ rawtx = self.nodes[0].createrawtransaction([], [{self.nodes[0].getnewaddress(): 10}])
+ fundedtx = self.nodes[0].fundrawtransaction(rawtx)
+ signedtx = self.nodes[0].signrawtransactionwithwallet(fundedtx["hex"])
+ assert_equal(signedtx["complete"], True)
+ signedtx2 = self.nodes[0].signrawtransactionwithwallet(signedtx["hex"])
+ assert_equal(signedtx2["complete"], True)
+ assert_equal(signedtx["hex"], signedtx2["hex"])
+ self.nodes[0].walletlock()
+
def witness_script_test(self):
self.log.info("Test signing transaction to P2SH-P2WSH addresses without wallet")
# Create a new P2SH-P2WSH 1-of-1 multisig address:
@@ -231,6 +244,7 @@ class SignRawTransactionsTest(BitcoinTestFramework):
self.witness_script_test()
self.OP_1NEGATE_test()
self.test_with_lock_outputs()
+ self.test_fully_signed_tx()
if __name__ == '__main__':
diff --git a/test/functional/rpc_uptime.py b/test/functional/rpc_uptime.py
index e86f91b1d0..6177970872 100755
--- a/test/functional/rpc_uptime.py
+++ b/test/functional/rpc_uptime.py
@@ -10,6 +10,7 @@ Test corresponds to code in rpc/server.cpp.
import time
from test_framework.test_framework import BitcoinTestFramework
+from test_framework.util import assert_raises_rpc_error
class UptimeTest(BitcoinTestFramework):
@@ -18,8 +19,12 @@ class UptimeTest(BitcoinTestFramework):
self.setup_clean_chain = True
def run_test(self):
+ self._test_negative_time()
self._test_uptime()
+ def _test_negative_time(self):
+ assert_raises_rpc_error(-8, "Mocktime can not be negative: -1.", self.nodes[0].setmocktime, -1)
+
def _test_uptime(self):
wait_time = 10
self.nodes[0].setmocktime(int(time.time() + wait_time))
diff --git a/test/functional/wallet_watchonly.py b/test/functional/wallet_watchonly.py
index b0c41b2738..2bf7c094e5 100755
--- a/test/functional/wallet_watchonly.py
+++ b/test/functional/wallet_watchonly.py
@@ -2,7 +2,7 @@
# Copyright (c) 2018-2019 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 createwallet arguments.
+"""Test createwallet watchonly arguments.
"""
from test_framework.test_framework import BitcoinTestFramework
@@ -50,6 +50,11 @@ class CreateWalletWatchonlyTest(BitcoinTestFramework):
assert_equal(len(wo_wallet.listtransactions()), 1)
assert_equal(wo_wallet.getbalance(include_watchonly=False), 0)
+ self.log.info('Test sending from a watch-only wallet raises RPC error')
+ msg = "Error: Private keys are disabled for this wallet"
+ assert_raises_rpc_error(-4, msg, wo_wallet.sendtoaddress, a1, 0.1)
+ assert_raises_rpc_error(-4, msg, wo_wallet.sendmany, amounts={a1: 0.1})
+
self.log.info('Testing listreceivedbyaddress watch-only defaults')
result = wo_wallet.listreceivedbyaddress()
assert_equal(len(result), 1)