-
Notifications
You must be signed in to change notification settings - Fork 35
Test listlockunspent
#332
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
base: master
Are you sure you want to change the base?
Test listlockunspent
#332
Conversation
integration_test/tests/wallet.rs
Outdated
let txid = utxo.txid.parse::<bitcoin::Txid>().expect("parse txid"); | ||
let vout = utxo.vout as u32; |
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.
Why not just use utxo.into_model()
?
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.
i.e., model::ListLockUnspentItem
has these fields.
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.
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.
In fd50399 the wallet__lock_unspent()
test still has this same pattern in 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.
Sorry, I forgot I had that bit in this patch. Done now and swapped the patch that changes account
to an option to be first.
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.
A small aside, because I switched to jj and have not got a fixed workflow yet: I rearranged the commits and did the edits without rebasing onto the updated master like I used to with git.
As a reviewer do you care either way, assuming no merge conflicts with the new master?
integration_test/tests/wallet.rs
Outdated
let model: Result<mtype::ListLockUnspent, ListLockUnspentItemError> = json.into_model(); | ||
let model = model.unwrap(); | ||
|
||
assert!(model.0.iter().any(|o| o.txid.to_string() == utxo.txid && o.vout as i64 == utxo.vout)); |
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.
Shouldn't need to allocate a string here. In general we only want to allocate if totally necessary. (This is a bit of geek thing, we always tend to optimize for speed even in test code.)
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.
Fixed by addressing the previous comment.
b7cc253
to
ce1d980
Compare
Addressed the comments. |
Reviewed ce1d980 |
When an unspent item is returned it does not contain the deprecated field `account`. Make the field an Option.
Testing `listlockunspent` requires `lockunspent` to lock a specified transaction. Change the client macro to take a `txid` and update the test.
`listlockunspent` was untested. Add a test
ce1d980
to
e36548b
Compare
Testing
listlockunspent
useslockunspent
andlistunspent
. This highlighted a couple of issues:lockunspent
needs atxid
as an input to lock a specific transaction, I am not sure anything is done if nothing is passed?listunspent
there is an error due to a missing fieldaccount
. This is listed in the help as deprecated and returns "" for the default account, but in the test it is not returned at all.Address these and add a test:
lockunspent
client macro to take atxid
.account
field inlistunspentitem
an option.listlockunspent
.