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

Add signrawtransactionwithwallet command interface #1561

Conversation

henryperson
Copy link
Contributor

Adds interface for issuing a signrawtransactionwithwallet command. It's heavily based on the code for signrawtransaction, which has been deprecated as of Bitcoin Core v0.17.0. Note that this does not add functionality for the btcd RPC server itself, it simply assumes that the RPC client one is connected to has this command already and gives an API for issuing the command. In other words, this works with a bitcoind client but not a btcd client.

This change makes btcd's getblock command match bitcoind's. Previously
the default verbosity was 0, which caused errors when using the
rpcclient library to connect to a bitcoind node - getblock would
unmarshall incorrectly since it didn't expect a verbosity=1 result when
it did not specify verbosity.
Adds interface for issuing a signrawtransactionwithwallet command.
Note that this does not add functionality for the btcd rpc server
itself, it simply assumes that the RPC client has this ability and gives
an API for interacting with the RPC client.
@jakesylvestre
Copy link
Collaborator

Hey, any chance you could force push here so we can get this merged? Github has an issue when required tests are swapped

@henryperson
Copy link
Contributor Author

Force push where?

@coveralls
Copy link

coveralls commented Sep 24, 2020

Pull Request Test Coverage Report for Build 276939909

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 8 of 73 (10.96%) changed or added relevant lines in 2 files are covered.
  • 9 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.09%) to 53.493%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/rawtransactions.go 0 65 0.0%
Files with Coverage Reduction New Missed Lines %
peer/peer.go 9 75.79%
Totals Coverage Status
Change from base Build 272743387: -0.09%
Covered Lines: 20745
Relevant Lines: 38781

💛 - Coveralls

@jakesylvestre
Copy link
Collaborator

I'm good to merge once we rebase into a single commit

@henryperson
Copy link
Contributor Author

henryperson commented Sep 26, 2020

Sorry this is a workflow I'm not used to and I don't want to mess anything up. You want me to rebase everything onto the oldest commit here? Looks like the oldest commit on the PR is e82643f so given your request I would take its parent 57d44d0 and run git rebase -i 57d44d0, which tries to rebase 66 commits. Let me know if that's right.

Also can you not just squash and merge?

type SignRawTransactionWithWalletCmd struct {
RawTx string
Inputs *[]RawTxWitnessInput
Flags *string `jsonrpcdefault:"\"ALL\""`
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use SigHashType as the field name here.

// function on the returned instance.
//
// See SignRawTransactionWithWallet2 for the blocking version and more details.
func (c *Client) SignRawTransactionWithWallet2Async(tx *wire.MsgTx,
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that coming up with the right function names is a bit tricky here. The issue with SignRawTransactionWithWallet# is that you need to read the documentation of all the variants to know which one to use.

I suggest using something more verbose, even if it makes the name inconveniently long. Something like:

  • SignRawTransactionWithWallet
  • SignRawTransactionWithWalletUsingInputs
  • SignRawTransactionWithWalletUsingInputsSighash

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually after seeing SignRawTransaction#, I'm kind of split. 🙂 So maybe it's better to follow the current convention, even if it's not so great.

@onyb
Copy link
Contributor

onyb commented Sep 27, 2020

@henryperson Rebase won't be easy in your case, due to some unnecessary commits in your branch. I suggest you clean up your branch in the following way:

$ git checkout master  # make sure master is up-to-date
$ git branch -D add-signrawtransactionwithwallet
$ git checkout -b add-signrawtransactionwithwallet
$ git cherry-pick e0afe48fdcf96508fe33347230a24c28be69af81
$ git push -f

@henryperson henryperson deleted the add-signrawtransactionwithwallet branch September 28, 2020 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants