sweep: do not combine exclusive and non-exclusive inputs

This commit is contained in:
Joost Jager 2020-09-07 13:29:28 +02:00
parent b6ebf3f27d
commit cdbde5dd4c
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

View File

@ -9,9 +9,20 @@ func (b bucket) tryAdd(input *pendingInput) bool {
if exclusiveGroup != nil {
for _, input := range b {
existingGroup := input.params.ExclusiveGroup
if existingGroup != nil &&
*existingGroup == *exclusiveGroup {
// Don't add an exclusive group input if other inputs
// are non-exclusive. The exclusive group input may be
// invalid (for example in the case of commitment
// anchors) and could thereby block sweeping of the
// other inputs.
if existingGroup == nil {
return false
}
// Don't combine inputs from the same exclusive group.
// Because only one input is valid, this may result in
// txes that are always invalid.
if *existingGroup == *exclusiveGroup {
return false
}
}