Skip to content

Commit

Permalink
asset: remove TODO in script key check
Browse files Browse the repository at this point in the history
Fixes a temporary TODO and makes the check nil-safe.
  • Loading branch information
guggero committed Jul 26, 2024
1 parent 90f551a commit 21ee689
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -1873,16 +1873,27 @@ func (a *Asset) deepEqual(allowSegWitIgnoreTxWitness bool, o *Asset) bool {
return false
}

// If both assets have a tweaked key
//
// TODO(roasbeef): fin
if !a.ScriptKey.PubKey.IsEqual(o.ScriptKey.PubKey) {
// If both assets have a script public key, comparing that is enough.
// We just want to know that we have the same key, not that the internal
// representation (e.g. the TweakedKey sub struct being set) is the same
// as well.
switch {
// If only one of the keys is nil, they are not equal.
case (a.ScriptKey.PubKey == nil && o.ScriptKey.PubKey != nil) ||
(a.ScriptKey.PubKey != nil && o.ScriptKey.PubKey == nil):

return false
}

/*if !reflect.DeepEqual(a.ScriptKey, o.ScriptKey) {
// If both are non-nil, we compare the public keys.
case a.ScriptKey.PubKey != nil && o.ScriptKey.PubKey != nil &&
!a.ScriptKey.PubKey.IsEqual(o.ScriptKey.PubKey):

return false
}*/

// If both are nil or both are non-nil and equal, we continue below.
default:
// Continue below
}

if !a.GroupKey.IsEqual(o.GroupKey) {
return false
Expand Down

0 comments on commit 21ee689

Please sign in to comment.