-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: Refactor rpc_fundrawtransaction.py #25291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Refactor rpc_fundrawtransaction.py #25291
Conversation
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0) | ||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0) | ||
|
||
self.generate(self.nodes[0], 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you duplicate this self.generate(self.nodes[0], 1)
, any reason? You moved it to here but you also added it in L684.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, generate mines a block so it has been duplicated to confirm the transactions preceding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only a suggestion, but I think this way would fit better.
diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py
index 338c31eea..71fda6362 100755
--- a/test/functional/rpc_fundrawtransaction.py
+++ b/test/functional/rpc_fundrawtransaction.py
@@ -103,13 +103,7 @@ class RawTransactionsTest(BitcoinTestFramework):
self.generate(self.nodes[2], 1)
self.generate(self.nodes[0], 121)
- # coins for simple tests
- self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5)
- self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
- self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0)
-
- self.generate(self.nodes[0], 1)
-
+ self.test_watchonly()
self.test_change_position()
self.test_simple()
self.test_simple_two_outputs()
@@ -132,7 +126,6 @@ class RawTransactionsTest(BitcoinTestFramework):
self.test_many_inputs_fee()
self.test_many_inputs_send()
self.test_op_return()
- self.test_watchonly()
self.test_all_watched_funds()
self.test_option_feerate()
self.test_address_reuse()
@@ -681,6 +674,11 @@ class RawTransactionsTest(BitcoinTestFramework):
self.nodes[0].lockunspent(False, [{"txid": self.watchonly_txid, "vout": self.watchonly_vout}])
self.nodes[0].sendtoaddress(self.nodes[3].get_wallet_rpc(self.default_wallet_name).getnewaddress(), self.watchonly_amount / 10)
+ # coins for simple tests
+ self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5)
+ self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
+ self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0)
+
self.generate(self.nodes[0], 1)
inputs = []
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
Looks like the test fails: https://cirrus-ci.com/task/5430192075177984?logs=ci#L3248
|
The failing test is testing wether fundrawtransaction selects enough fees to cover the transaction after signing. Changes made in this PR should at most change the available coins inside the wallet. I can't think of any reason for this test failing, other than there being some edge case in the fundrawtransaction's fees mechanism that these changes have chanced upon. |
The current test_simple_two_coins and test_simple are identical and redundant. The test_simple_two_coins was changed in pr#6417 and asserts ensuring the use of two input coins were removed.
The current method assumes that a coin with value > 2 BTC was used to fund the transaction, and therefore change will be greater than 1 BTC. This can fail. changepos allows us to get the change output much more reliably and cleanly.
1bddea8
to
00af305
Compare
rebased. |
00af305
to
25b9f2e
Compare
I don't know either why it happens. Though, this can not be merged with a failing test. |
25b9f2e
to
3e5bc2c
Compare
The failing test passed after removing the 3rd commit. |
You'll have to adjust the pull request description? |
Closing this as it has not had a lot of conceptual support. If you are interested in continuing work on this, please leave a comment so that it can be reopened. |
The changes look correct to me |
Made 2 changes to
tests/functional/rpc_fundrawtransaction.py
-