aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0xlt <woltx@protonmail.com>2022-10-19 16:10:04 -0300
committerfanquake <fanquake@gmail.com>2022-10-28 18:01:36 +0800
commitd5701900fcf70220701a1686588114db165dce1c (patch)
treefa1a5ca8fc06edb07fdd3e06ad2d307bfc00b4a2 /test
parente4b8c9b2bf2118064e68d33f6b7207e721ae03dd (diff)
downloadbitcoin-d5701900fcf70220701a1686588114db165dce1c.tar.xz
rpc: make `address` field optional
Github-Pull: #26349 Rebased-From: eb679a7896ce00e322972a011b023661766923b9
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_listsinceblock.py14
-rwxr-xr-xtest/functional/wallet_listtransactions.py12
2 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py
index f259449bef..aff408ceb1 100755
--- a/test/functional/wallet_listsinceblock.py
+++ b/test/functional/wallet_listsinceblock.py
@@ -45,6 +45,7 @@ class ListSinceBlockTest(BitcoinTestFramework):
if self.options.descriptors:
self.test_desc()
self.test_send_to_self()
+ self.test_op_return()
def test_no_blockhash(self):
self.log.info("Test no blockhash")
@@ -448,6 +449,19 @@ class ListSinceBlockTest(BitcoinTestFramework):
assert any(c["address"] == addr for c in coins)
assert all(self.nodes[2].getaddressinfo(c["address"])["ischange"] for c in coins)
+ def test_op_return(self):
+ """Test if OP_RETURN outputs will be displayed correctly."""
+ block_hash = self.nodes[2].getbestblockhash()
+
+ raw_tx = self.nodes[2].createrawtransaction([], [{'data': 'aa'}])
+ funded_tx = self.nodes[2].fundrawtransaction(raw_tx)
+ signed_tx = self.nodes[2].signrawtransactionwithwallet(funded_tx['hex'])
+ tx_id = self.nodes[2].sendrawtransaction(signed_tx['hex'])
+
+ op_ret_tx = [tx for tx in self.nodes[2].listsinceblock(blockhash=block_hash)["transactions"] if tx['txid'] == tx_id][0]
+
+ assert 'address' not in op_ret_tx
+
if __name__ == '__main__':
ListSinceBlockTest().main()
diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py
index 7c16b6328d..9bb06774a5 100755
--- a/test/functional/wallet_listtransactions.py
+++ b/test/functional/wallet_listtransactions.py
@@ -109,6 +109,7 @@ class ListTransactionsTest(BitcoinTestFramework):
self.run_rbf_opt_in_test()
self.run_externally_generated_address_test()
self.run_invalid_parameters_test()
+ self.test_op_return()
def run_rbf_opt_in_test(self):
"""Test the opt-in-rbf flag for sent and received transactions."""
@@ -284,6 +285,17 @@ class ListTransactionsTest(BitcoinTestFramework):
assert_raises_rpc_error(-8, "Negative count", self.nodes[0].listtransactions, count=-1)
assert_raises_rpc_error(-8, "Negative from", self.nodes[0].listtransactions, skip=-1)
+ def test_op_return(self):
+ """Test if OP_RETURN outputs will be displayed correctly."""
+ raw_tx = self.nodes[0].createrawtransaction([], [{'data': 'aa'}])
+ funded_tx = self.nodes[0].fundrawtransaction(raw_tx)
+ signed_tx = self.nodes[0].signrawtransactionwithwallet(funded_tx['hex'])
+ tx_id = self.nodes[0].sendrawtransaction(signed_tx['hex'])
+
+ op_ret_tx = [tx for tx in self.nodes[0].listtransactions() if tx['txid'] == tx_id][0]
+
+ assert 'address' not in op_ret_tx
+
if __name__ == '__main__':
ListTransactionsTest().main()