-
Notifications
You must be signed in to change notification settings - Fork 33
Address all TODO in v24 #308
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
65da4c9
to
1de8ce4
Compare
client/src/client_sync/v24/mod.rs
Outdated
pub struct GetTxSpendingPrevoutInput { | ||
/// The transaction id. | ||
pub txid: Txid, | ||
/// The output number. | ||
pub vout: 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.
In 5579b79
This is the same as a bitcoin::OutPoint
- we can use that instead.
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.
Done
types/src/model/blockchain.rs
Outdated
/// The transaction id of the checked output. | ||
pub txid: Txid, | ||
/// The vout value of the checked output. | ||
pub vout: 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.
Might be able to use an OutPoint
here 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.
Done
types/src/v24/blockchain/into.rs
Outdated
|
||
impl GetTxSpendingPrevoutItem { | ||
/// Converts version specific type to a version nonspecific, more strongly typed type. | ||
pub fn into_model(self) -> Result<model::GetTxSpendingPrevoutItem, hex::HexToArrayError> { |
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.
Whilst this is correct it would be nicer, and more inline with the rest of the crate (I hope) to have a custom error here with two variants, one for each conversion that can fail. If there are other places that do this sort of thing already then feel free to be lazy and leave it as is. If you do chose that can you write an issue explaining the lazy choice please?
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.
Made the custom error with two variants.
types/src/v24/blockchain/into.rs
Outdated
let spending_txid = match self.spending_txid { | ||
Some(id) => Some(id.parse::<Txid>()?), | ||
None => None, | ||
}; |
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.
Just FYI this can probably be done more cleanly using map
, pretty sure linter should fire for this 'manual implementation of map' or some such error. If not we may not have the linter configured as tightly as in rust-bitcoin
.
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.
Done
client/src/client_sync/v24/wallet.rs
Outdated
macro_rules! impl_client_v24__send_all { | ||
() => { | ||
impl Client { | ||
pub fn send_all(&self, recipients: &[String]) -> Result<SendAll> { |
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.
Would be nicer to use Address
than String
unless there is some specific reason not to.
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.
Done
integration_test/tests/wallet.rs
Outdated
let recipients = vec![address.to_string()]; | ||
|
||
let json: SendAll = node.client.send_all(&recipients).expect("sendall"); |
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.
We can probably just use &[address]
inline in send_all
.
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.
Done
let hex = | ||
self.hex.as_ref().map(|h| encode::deserialize_hex(h)).transpose().map_err(E::Hex)?; |
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.
This line is changed in fd06f28 but that patch is unrelated.
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.
Moved to the correct commit
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.
Reviewed 1de8ce4
Add the struct for the RPC, the model, client macro, reexports and test.
Add the struct, model, client macro, reexports and test.
New RPC migratewallet takes around 30sec to complete and the client times out first. Increase the timeout from default of 15sec to 60sec.
Add the struct, client macro, reexports and test. No model is required, change the types table to `version`, update verify and remove TODO.
Add the struct, client macro, model, reexports and test.
Reordering of reexports alphabetically, no other changes.
1de8ce4
to
78cbbdc
Compare
Suggested changes all made. |
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.
ACK 78cbbdc
serde_json::json!({ | ||
"txid": out.txid.to_string(), | ||
"vout": out.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.
Something is odd here, we should be able to use into_json(out)
.
Go through all the TODO in the v24 types table. Add all the missing RPCs.
gettxspendingprevout
method, model and testsendall
method, model and testclient
timeout - Themigratewallet
RPC call takes about 30sec on v24, it's a lot faster on v29. The default timeout was 15sec, increase it to 60 to prevent the timeout during testing. To quote Core "This RPC may take a long time to complete. Increasing the RPC client timeout is recommended."migratewallet
method, and test - The help says thatpassphrase
is required in v24, but it isn't. The optional argumentwallet_name
was required for testing. There is nothing to model so the types table was updated accordingly.simulaterawtransaction
method, model and test - The help says that therawtxs
are optional, but theyare required for testing or nothing is simulated.