Skip to content

issue #306 Remain functionally compatible with pre-25.0 sendrawtransa… #307

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

Closed
wants to merge 1 commit into from

Conversation

ShitcoinsSuck
Copy link

…ction be setting maxburnamount to max supply

This code will check the bitcoin core version, and if it's 25.0+ it will send the 2 optional parameters (maxfeerate and maxburnamount). See issue #306 for details.

It may be preferable to store the version and only get it once per library instance. Otherwise it doubles the number of RPC calls required for any function that must know the bitcoin core version to function properly (i.e. one RPC call to get the version, and then the actual desired RPC call).

…endrawtransaction be setting maxburnamount to max supply
Copy link

@CharliesAngel1 CharliesAngel1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve

Copy link
Collaborator

@stevenroose stevenroose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some nits. But for a real review, I'd have to check how Core takes these new arguments. Are you sure we can't just provide null for them? "max burn" seems something so niche that I would be surprised if Core is requiring that field on every sendrawtransaction call..

@@ -1078,7 +1078,17 @@ pub trait RpcApi: Sized {
}

fn send_raw_transaction<R: RawTx>(&self, tx: R) -> Result<bitcoin::Txid> {
self.call("sendrawtransaction", &[tx.raw_hex().into()])
let server_version=self.version()?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls either inline this or put spaces around the =

if server_version < 250000 {
self.call("sendrawtransaction", &[tx.raw_hex().into()])
}
else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Pls remove the newline before the else.

// default max rate in bitcoin core is 0.1 COIN
let default_max_raw_tx_fee_rate : f64 = 0.1;
// default max burn set to max COIN supply to be compatible with pre-25.0 functionality
let default_max_burn : i64 = 21000000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Please remove the space before the :.

@stevenroose
Copy link
Collaborator

Ok, I checked the issue you crated. I'd NACK this. It's not our goal to make new versions of Core behave like old versions. Users that upgrade to a newer Core release should be aware of the changes.

The only thing we could do here is support the two optional arguments so that users can actually pass them in from 0.25 on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants