-
Notifications
You must be signed in to change notification settings - Fork 276
ChannelKeyManager: add optional list of spent outputs to sign() methods #3047
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
Conversation
t-bast
left a comment
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 don't understand: you're not actually using this new field anywhere, but you should? In particular in ReplaceableTxFunder, there are a few places where we use keyManager.sign and actually have added wallet inputs: not providing them in the new field is a bug! We shouldn't care about whether we're using taproot or not at that point, this is unnecessarily risky: we should just always provide the additional wallet inputs we're adding.
I don't think this new field should be optional with a default None value, that makes us miss places where we must fill it if we add wallet inputs. It's also unclear in Transactions.scala whether this should contain all inputs or all inputs that are not already our InputInfo.
Overall, I think that this new field should:
- not have a default value of
Nonein methods - should be for wallet inputs that we've added (ie not include the
InputInfoforTransactionWithInputInfo, otherwise it creates unnecessary duplication)
You should also update the "generate valid commitment and htlc transactions (taproot)" test in TransactionsSpec.scala to show that when we add wallet inputs, not providing this field results in silently producing a signature that is invalid.
I could not find a way to demonstrate that signing in
It would be cleaner to only pass additional wallet inputs, but it means that we expect our |
|
I went with your proposal in cd74ecc. It's cleaner, and the implicit requirement to always add additional inputs after the one we want to bump is acceptable (it's what we do now). I also added a test to |
eclair-core/src/main/scala/fr/acinq/eclair/transactions/Transactions.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fund/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/crypto/keymanager/ChannelKeyManager.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
2a5f89f to
6435245
Compare
This is needed to sign inputs that spend taproot outputs.
This outputs are typically wallet inputs added to a transaction to bump it.
…s we want to bump
6435245 to
81782f3
Compare
|
Rebased on master at 3d415bc |
eclair-core/src/main/scala/fr/acinq/eclair/transactions/Transactions.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/publish/ReplaceableTxFunder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fund/InteractiveTxBuilder.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/publish/ReplaceableTxPublisherSpec.scala
Outdated
Show resolved
Hide resolved
dc36ada to
5dcf2b2
Compare
We verify that details about all inputs are provided to the `sign` function. While this isn't mandatory for segwit v0, it ensures that all of our existing tests exercise this codepath and reduces the risk that we forget to provide some wallet inputs, which would result in an invalid signature which would be hard to investigate. With this change, some of the unit tests started failing, which showed that we weren't correctly setting wallet inputs in the fee-bumping case in `ReplaceableTxFunder`, which we've fixed. We also add a test in `TransactionsSpec.scala` to verify that signing fails when details about some inputs are missing.
This is needed to sign inputs that spend taproot outputs.