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

btcjson,rpcclient: add support for PSBT commands to rpcclient #1596

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

federicobond
Copy link
Contributor

No description provided.

@Rjected
Copy link
Collaborator

Rjected commented Jul 17, 2020

Hello, you'll need to fix the CI issues in order for this to get reviewed and merged. Thanks for the contribution!

@federicobond
Copy link
Contributor Author

@Rjected thanks for the heads up! Yeah, its weird though, I could not find out what exactly is it complaining about, the file appears formatted correctly.

@Rjected
Copy link
Collaborator

Rjected commented Aug 24, 2020

Hey, sorry for getting back so late. Here are the changes you'd need to do to fix the formatting issues: Rjected@23478ac . There are also now some conflicts, make sure those are fixed as well and then we can start reviewing!

@federicobond
Copy link
Contributor Author

Ah, that makes sense. Thanks for the heads up.

@federicobond
Copy link
Contributor Author

This is now ready for review.

Copy link
Collaborator

@onyb onyb left a comment

Choose a reason for hiding this comment

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

Nice work on the PR!

Most of my remarks are about types. Please also feel free to pull in some descriptions from Bitcoin Core docs wherever relevant. It doesn't need to be an exact copy, but just enough to guide the users and show it beautifully on pkg.go.dev.

rpcclient/wallet.go Show resolved Hide resolved
rpcclient/wallet.go Outdated Show resolved Hide resolved
rpcclient/wallet.go Outdated Show resolved Hide resolved
rpcclient/wallet.go Outdated Show resolved Hide resolved
btcjson/walletsvrresults.go Show resolved Hide resolved
btcjson/btcwalletextcmds.go Outdated Show resolved Hide resolved
btcjson/btcwalletextcmds.go Outdated Show resolved Hide resolved
btcjson/btcwalletextcmds.go Outdated Show resolved Hide resolved
btcjson/btcwalletextcmds.go Outdated Show resolved Hide resolved
btcjson/btcwalletextcmds.go Outdated Show resolved Hide resolved
@onyb
Copy link
Collaborator

onyb commented Aug 27, 2020

I'm wondering if btcwalletextcmds.go is the right file for defining the types. This is what the header of the file says:

// NOTE: This file is intended to house the RPC commands that are supported by
// a wallet server with btcwallet extensions.

Compare that to walletsvrcmds.go, where we have this:

// NOTE: This file is intended to house the RPC commands that are supported by
// a wallet server.

Using walletsvrcmds.go would be more appropriate.

@federicobond
Copy link
Contributor Author

I moved the PSBT methods to walletsvrcmds.go as suggested.

btcjson/chainsvrcmds.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@onyb onyb left a comment

Choose a reason for hiding this comment

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

Added some more minor review comments.

btcjson/walletsvrcmds.go Outdated Show resolved Hide resolved
Comment on lines 766 to 773
var (
SighashAll SighashType = "ALL"
SighashNone SighashType = "NONE"
SighashSingle SighashType = "SINGLE"
SighashAllAnyoneCanPay SighashType = "ALL|ANYONECANPAY"
SighashNoneAnyoneCanPay SighashType = "NONE|ANYONECANPAY"
SighashSingleAnyoneCanPay SighashType = "SINGLE|ANYONECANPAY"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to have comments here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I just noticed that rpcclient already defines a SigHashType type. I think it will be more clear to use that and then convert to *string for the btcjson constructors (to avoid a circular import). This is consistent with the behaviour of SignRawTransaction.

Copy link
Collaborator

Choose a reason for hiding this comment

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

SigHashType should've really been in btcjson package. But there's nothing we can do about it now, without introducing a breaking change. Let's keep it for later.

btcjson/walletsvrcmds.go Outdated Show resolved Hide resolved
@federicobond
Copy link
Contributor Author

Fixed the conflicts, should be ready to merge.

Copy link
Collaborator

@onyb onyb left a comment

Choose a reason for hiding this comment

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

All good on my side!

rpcclient/wallet.go Outdated Show resolved Hide resolved
Copy link
Member

@jcvernaleo jcvernaleo left a comment

Choose a reason for hiding this comment

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

Looks good to me.

) (*btcjson.WalletProcessPsbtResult, error) {
return c.WalletProcessPsbtAsync(psbt, sign, sighashType, bip32Derivs).Receive()
}

// TODO(davec): Implement
Copy link
Collaborator

Choose a reason for hiding this comment

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

might make sense to remove these in favor of issues, but not germane to this review

@jcvernaleo jcvernaleo merged commit 6f49f1f into btcsuite:master Sep 14, 2020
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.

5 participants