mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge bitcoin/bitcoin#18919: test: Add gettransaction test for "coin-join" tx
fa20f8919c
test: Add gettransaction test for "coin-join" tx (MarcoFalke) Pull request description: ACKs for top commit: furszy: utACKfa20f8919c
Tree-SHA512: 6e92455ef478d6bf2c544910402be9046698ded66f1f68d5fe5b989aafc20ba0537d362331e0e653595bca553166f6197fe548bdd0bcf295743775b8afb663a1
This commit is contained in:
commit
930bcfd4cd
@ -111,6 +111,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.run_rbf_opt_in_test()
|
self.run_rbf_opt_in_test()
|
||||||
self.run_externally_generated_address_test()
|
self.run_externally_generated_address_test()
|
||||||
|
self.run_coinjoin_test()
|
||||||
self.run_invalid_parameters_test()
|
self.run_invalid_parameters_test()
|
||||||
self.test_op_return()
|
self.test_op_return()
|
||||||
|
|
||||||
@ -281,6 +282,34 @@ class ListTransactionsTest(BitcoinTestFramework):
|
|||||||
assert_equal(['pizza2'], self.nodes[0].getaddressinfo(addr2)['labels'])
|
assert_equal(['pizza2'], self.nodes[0].getaddressinfo(addr2)['labels'])
|
||||||
assert_equal(['pizza3'], self.nodes[0].getaddressinfo(addr3)['labels'])
|
assert_equal(['pizza3'], self.nodes[0].getaddressinfo(addr3)['labels'])
|
||||||
|
|
||||||
|
def run_coinjoin_test(self):
|
||||||
|
self.log.info('Check "coin-join" transaction')
|
||||||
|
input_0 = next(i for i in self.nodes[0].listunspent(query_options={"minimumAmount": 0.2}, include_unsafe=False))
|
||||||
|
input_1 = next(i for i in self.nodes[1].listunspent(query_options={"minimumAmount": 0.2}, include_unsafe=False))
|
||||||
|
raw_hex = self.nodes[0].createrawtransaction(
|
||||||
|
inputs=[
|
||||||
|
{
|
||||||
|
"txid": input_0["txid"],
|
||||||
|
"vout": input_0["vout"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"txid": input_1["txid"],
|
||||||
|
"vout": input_1["vout"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
outputs={
|
||||||
|
self.nodes[0].getnewaddress(): 0.123,
|
||||||
|
self.nodes[1].getnewaddress(): 0.123,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
raw_hex = self.nodes[0].signrawtransactionwithwallet(raw_hex)["hex"]
|
||||||
|
raw_hex = self.nodes[1].signrawtransactionwithwallet(raw_hex)["hex"]
|
||||||
|
txid_join = self.nodes[0].sendrawtransaction(hexstring=raw_hex, maxfeerate=0)
|
||||||
|
fee_join = self.nodes[0].getmempoolentry(txid_join)["fees"]["base"]
|
||||||
|
# Fee should be correct: assert_equal(fee_join, self.nodes[0].gettransaction(txid_join)['fee'])
|
||||||
|
# But it is not, see for example https://github.com/bitcoin/bitcoin/issues/14136:
|
||||||
|
assert fee_join != self.nodes[0].gettransaction(txid_join)["fee"]
|
||||||
|
|
||||||
def run_invalid_parameters_test(self):
|
def run_invalid_parameters_test(self):
|
||||||
self.log.info("Test listtransactions RPC parameter validity")
|
self.log.info("Test listtransactions RPC parameter validity")
|
||||||
assert_raises_rpc_error(-8, 'Label argument must be a valid label name or "*".', self.nodes[0].listtransactions, label="")
|
assert_raises_rpc_error(-8, 'Label argument must be a valid label name or "*".', self.nodes[0].listtransactions, label="")
|
||||||
|
Loading…
Reference in New Issue
Block a user