Skip to content
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

Adds generate_block function to Client #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

p0lunin
Copy link

@p0lunin p0lunin commented Jul 26, 2021

This PR adds a generate_block function to Client type according to the reference page https://developer.bitcoin.org/reference/rpc/generateblock.html.

fn generate_block(
&self,
output: &Address,
transactions: &[bitcoin::Txid],
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: As per linked documentation Bitcoin Core accepts both txids and raw transaction in hex here.

Not sure if it's worth going the extra mile to be able to pass raw transaction in hex here too.

Choose a reason for hiding this comment

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

One of the main use cases for the generateblock rpc is to perform a double spend of a tx that is in bitcoind's mempool. In that case a raw transaction is required since bitcoind won't be able to find the tx by txid.

@0xB10C
Copy link
Contributor

0xB10C commented Aug 25, 2021

You could add an integration test.

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.

None yet

3 participants