Skip to content

Commit

Permalink
add checked typed assert for alias output
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-moser committed Aug 26, 2022
1 parent 917c323 commit 6153f77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,15 @@ func TxSemanticInputUnlocks() TxSemanticValidationFunc {
}

// for alias outputs which are not state transitioning, we do not add it to the set of unlocked chains
if current, ok := chainConstrOutput.(*AliasOutput); ok {
if currentAlias, ok := chainConstrOutput.(*AliasOutput); ok {
next, hasNextState := svCtx.WorkingSet.OutChains[chainID]
if !hasNextState || (current.StateIndex+1 != next.(*AliasOutput).StateIndex) {
if !hasNextState {
continue
}
// note that isAlias should never be false in practice,
// but we add it anyway as an additional safeguard
nextAlias, isAlias := next.(*AliasOutput)
if !isAlias || (currentAlias.StateIndex+1 != nextAlias.StateIndex) {
continue
}
}
Expand Down

0 comments on commit 6153f77

Please sign in to comment.