-
Notifications
You must be signed in to change notification settings - Fork 31
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
base: master
Are you sure you want to change the base?
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.
#[test] | ||
fn wallet__set_tx_fee() { | ||
let node = Node::with_wallet(Wallet::Default, &[]); | ||
let fee_rate = FeeRate::from_sat_per_vb(2).expect("fee_rate"); |
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.
Since you have to rebase anyways can you change this to
let fee_rate = FeeRate::from_sat_per_vb(2).expect("fee_rate"); | |
let fee_rate = FeeRate::from_sat_per_vb(2).expect("2 sat/vb is valid"); |
The idea being the expect message is basically a comment to those reading the code and is never going to be hit at runtime.
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
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