-
Notifications
You must be signed in to change notification settings - Fork 119
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
[wallet]: only select BIP-86 script keys for channel funding, add flag to FundVirtualPsbt #1115
Conversation
Pull Request Test Coverage Report for Build 10697119132Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix!
tapfreighter/chain_porter.go
Outdated
@@ -994,7 +994,7 @@ func (p *ChainPorter) stateStep(currentPkg sendPackage) (*sendPackage, error) { | |||
"address parcel") | |||
} | |||
fundSendRes, err := p.cfg.AssetWallet.FundAddressSend( | |||
ctx, addrParcel.destAddrs..., | |||
ctx, true, addrParcel.destAddrs..., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can make this diff/change and future call sites more readable if we introduce an enum early here instead of a bool
.
It could be something like (random names, can def be improved):
type CoinSelectType uint8
const (
DefaultCoinSelect CoinSelectType
Bip86Only
ScriptTreesAllowed
)
Then we can make DefaultCoinSelect = Bip86Only
when parsing, which is typically the behavior you want unless doing something fancy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! Changed the type. But had to keep the default value at ScriptTreesAllowed
to not break existing users of the FundVirtualPsbts
RPC call (which is primarily used for doing script sends, at least in our itests).
24d644e
to
d942981
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, AFAICT the default for FundVirtualPsbt
will be the same but FundAddressSend
will be BIP86 only.
Would be nice to have less negations in the path from the enum to the actual DB filter, but minor nit / non-blocking.
I'm not sure what you mean. Are you referencing the naming/wording from "only" and "allowed" that is later mapped to a single boolean? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 📈
Fixes a bug that caused channel funding transactions to be mistakenly used for coin selection, even though they are known to be script path only spend assets.