-
Notifications
You must be signed in to change notification settings - Fork 35
Implement settxfee method and test #285
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
() => { | ||
impl Client { | ||
pub fn set_tx_fee(&self, fee_rate: bitcoin::FeeRate) -> Result<SetTxFee> { | ||
let fee_rate_btc_kvb = fee_rate.to_sat_per_vb_floor() as f64 / 100_000.0; |
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 is correct and drinks on me because you found an API hole in rust-bitcoin
. See rust-bitcoin/rust-bitcoin#4688 if you are interested.
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.
Woaw, interesting, reading through the issue and conversations.
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.
Interestingly copilot picked this out as an issue with the PR: although mathematically correct, it says "rust-bitcoin does not provide a safe, explicit conversion between FeeRate and the units expected by Core's settxfee
". It managed to actually look at the referenced issue and give a sane answer. It has improved even in the last 6 months. Still can't trust it though 😊.
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.
Mad, keep me posted of any AI wins please. I"m a bit of a ludite and I don't want to fall too far behind.
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.
Interestingly copilot picked this out as an issue with the PR: although mathematically correct, it says "rust-bitcoin does not provide a safe, explicit conversion between FeeRate and the units expected by Core's
settxfee
". It managed to actually look at the referenced issue and give a sane answer. It has improved even in the last 6 months. Still can't trust it though 😊.
Woah, that’s cool. They’ve definitely come a long way...
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.
Needs rebase mate.
Reviewed: ab928fa
Improve test expect message
rebased and worked on the suggestion given. |
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 52e1b53
() => { | ||
impl Client { | ||
pub fn set_tx_fee(&self, fee_rate: bitcoin::FeeRate) -> Result<SetTxFee> { | ||
let fee_rate_btc_kvb = fee_rate.to_sat_per_vb_floor() as f64 / 100_000.0; |
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.
Interestingly copilot picked this out as an issue with the PR: although mathematically correct, it says "rust-bitcoin does not provide a safe, explicit conversion between FeeRate and the units expected by Core's settxfee
". It managed to actually look at the referenced issue and give a sane answer. It has improved even in the last 6 months. Still can't trust it though 😊.
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 52e1b53
The JSON-RPC method
settxfee
does return a type. We want to test this to catch any changes in behavior in future Core versions.This PR adds a client function that errors if the return value is anything other than the type it returns, along with an integration test that calls this function.
Ref: #116