Skip to content

Commit 930bcfd

Browse files
committed
Merge bitcoin#18919: test: Add gettransaction test for "coin-join" tx
fa20f89 test: Add gettransaction test for "coin-join" tx (MarcoFalke) Pull request description: ACKs for top commit: furszy: utACK fa20f89 Tree-SHA512: 6e92455ef478d6bf2c544910402be9046698ded66f1f68d5fe5b989aafc20ba0537d362331e0e653595bca553166f6197fe548bdd0bcf295743775b8afb663a1
2 parents f4073c5 + fa20f89 commit 930bcfd

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/functional/wallet_listtransactions.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def run_test(self):
111111

112112
self.run_rbf_opt_in_test()
113113
self.run_externally_generated_address_test()
114+
self.run_coinjoin_test()
114115
self.run_invalid_parameters_test()
115116
self.test_op_return()
116117

@@ -281,6 +282,34 @@ def normalize_list(txs):
281282
assert_equal(['pizza2'], self.nodes[0].getaddressinfo(addr2)['labels'])
282283
assert_equal(['pizza3'], self.nodes[0].getaddressinfo(addr3)['labels'])
283284

285+
def run_coinjoin_test(self):
286+
self.log.info('Check "coin-join" transaction')
287+
input_0 = next(i for i in self.nodes[0].listunspent(query_options={"minimumAmount": 0.2}, include_unsafe=False))
288+
input_1 = next(i for i in self.nodes[1].listunspent(query_options={"minimumAmount": 0.2}, include_unsafe=False))
289+
raw_hex = self.nodes[0].createrawtransaction(
290+
inputs=[
291+
{
292+
"txid": input_0["txid"],
293+
"vout": input_0["vout"],
294+
},
295+
{
296+
"txid": input_1["txid"],
297+
"vout": input_1["vout"],
298+
},
299+
],
300+
outputs={
301+
self.nodes[0].getnewaddress(): 0.123,
302+
self.nodes[1].getnewaddress(): 0.123,
303+
},
304+
)
305+
raw_hex = self.nodes[0].signrawtransactionwithwallet(raw_hex)["hex"]
306+
raw_hex = self.nodes[1].signrawtransactionwithwallet(raw_hex)["hex"]
307+
txid_join = self.nodes[0].sendrawtransaction(hexstring=raw_hex, maxfeerate=0)
308+
fee_join = self.nodes[0].getmempoolentry(txid_join)["fees"]["base"]
309+
# Fee should be correct: assert_equal(fee_join, self.nodes[0].gettransaction(txid_join)['fee'])
310+
# But it is not, see for example https://github.com/bitcoin/bitcoin/issues/14136:
311+
assert fee_join != self.nodes[0].gettransaction(txid_join)["fee"]
312+
284313
def run_invalid_parameters_test(self):
285314
self.log.info("Test listtransactions RPC parameter validity")
286315
assert_raises_rpc_error(-8, 'Label argument must be a valid label name or "*".', self.nodes[0].listtransactions, label="")

0 commit comments

Comments
 (0)