Skip to content

Implement sethdseed method and test #283

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

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

GideonBature
Copy link
Contributor

The JSON-RPC method sethdseed does not return anything. 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 null, along with an integration test that calls this function.

Ref: #116

@GideonBature GideonBature marked this pull request as draft July 4, 2025 03:31
@GideonBature GideonBature marked this pull request as ready for review July 4, 2025 03:35
@GideonBature
Copy link
Contributor Author

Had merge conflict, have to rebase.

@GideonBature GideonBature force-pushed the sethdseed branch 3 times, most recently from 25ed5e9 to ee82283 Compare July 4, 2025 04:26
jamillambert
jamillambert previously approved these changes Jul 4, 2025
Copy link
Collaborator

@jamillambert jamillambert left a comment

Choose a reason for hiding this comment

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

ACK ee82283

() => Node::with_wallet(Wallet::Default, &[]),
#[cfg(not(feature = "v22_and_below"))]
() => {
let node = Node::with_wallet(Wallet::None, &["-deprecatedrpc=create_bdb"]);
Copy link
Member

Choose a reason for hiding this comment

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

What are you adding this flag for? I see you've done this a bunch of times and I never got round to asking, my bad. I got the test to pass without it.

When you force push perhaps add

            // sethdseed is only used for non-descriptor wallets which are the default in v23 onwards.

because I had to go digging to find out why we need a legacy wallet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added -deprecatedrpc=create_bdb because the test calls sethdseed, which is only available on legacy wallets. From v23 onwards, Bitcoin Core uses descriptor wallets by default, and BDB wallet creation is deprecated unless explicitly re-enabled via this flag. Without it, I get the error below:

createlegacywallet: JsonRpc(Rpc(RpcError { code: -4, message: "BDB wallet creation is deprecated and will be removed in a future release. In this release it can be re-enabled temporarily with the -deprecatedrpc=create_bdb setting.", data: None }))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is why for v23 onwards, some of the rpc methods are only supported on legacy wallet, that is why I use legacy wallet, and to create_legacy_wallet, some of the methods also required passing in that flag to create a BDB wallet for them to work.

Copy link
Member

@tcharding tcharding Jul 7, 2025

Choose a reason for hiding this comment

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

Thanks for the explanation. Weirdly I swear I got the test to pass yesterday without the flag. Perhaps we could add a Legacy variant to Wallet then use with_wallet(Wallet::Legacy) to hide all these details? Want to either have a crack at that or write up an issue explaining the problem? Just holla if you don't want to and I can write an issue.

@GideonBature
Copy link
Contributor Author

GideonBature commented Jul 7, 2025

Removed the feature gating and used fund_wallet method as suggested in the integration test.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK cce7153

@tcharding tcharding merged commit e422371 into rust-bitcoin:master Jul 7, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants