-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Add listunspent() test for spendable/unspendable UTXO #7822
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
Conversation
for txin in rawtx["vin"]: | ||
for utxo in list_unspent_after: | ||
if (txin["txid"] == utxo["txid"] and txin["vout"] == utxo["vout"]): | ||
raise AssertionError("Fount used output on UTXOs list") |
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.
Nit: typo
Thanks, Concept ACK. |
0d8581d
to
534ef0c
Compare
I'm a bit divided whether I should propose to add this into the wallet test, which already uses |
I think such overhead is rather small. (Note that disablewallet.py runs in less than a second) The overhead probably is caused by setting up the bidirectional connections and sync_all() calls. I have not yet looked closely at the test (I try to avoid large diffs right now in the /qa subfolder as each patch may or may not silently conflict with the python3 refactoring work.) @jpdffonseca Would you mind to take a look if this can be neatly squashed into the wallet.py test, as suggested by @laanwj ? |
@MarcoFalke and @laanwj yes that makes sense. I will try to squash this verifications into |
0f714f0
to
3b2eedc
Compare
@MarcoFalke, after checking that |
Thanks. Looks better now. utACK 3b2eedc |
@@ -6,6 +6,27 @@ | |||
from test_framework.test_framework import BitcoinTestFramework | |||
from test_framework.util import * | |||
|
|||
def check_array_result(object_array, to_match, expected): |
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.
If you copied this function from elsewhere, wouldn't it make sense to move it instead to test_framework/util.py
, so the utility function can be used in other tests as well?
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.
Indeed.. It is used by multiple tests. I think it comes in handy for current and future test cases. If you guys agree I guess this could be moved to test_framework/util.py
to be reused whenever needed..
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.
Sure, go ahead.
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.
Do you intend to do so in this pull? If so I'll wait with merging.
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, since we are on this topic.
3b2eedc
to
5d217de
Compare
Moved I noticed that the previous method on |
utACK 5d217de |
Github-Pull: bitcoin#7822 Rebased-From: fa942c7 5d217de
This PR adds a test on
wallet.py
covering the behavior of spendable/unspendable value for UTXO, when calling RPClistunspent
.This value should be different for address or private key import.