Skip to content

Commit

Permalink
Merge pull request lightninglabs#234 from ellemouton/skipInputScripts…
Browse files Browse the repository at this point in the history
…DuringVerification

verification: skip checking input scripts
  • Loading branch information
Roasbeef authored Nov 4, 2021
2 parents 51686db + b785905 commit 1f53451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 4 additions & 2 deletions verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ func VerifyBasicBlockFilter(filter *gcs.Filter, block *btcutil.Block) (int,
}

if !match {
return 0, fmt.Errorf("filter for block %v is "+
log.Errorf("filter for block %v might be "+
"invalid, input %d of tx %v spends "+
"pk script %x which wasn't matched by "+
"filter", block.Hash(), inIdx,
"filter. The input likely spends a "+
"taproot output which is not yet"+
"supported", block.Hash(), inIdx,
tx.Hash(), script.Script())
}
}
Expand Down
10 changes: 2 additions & 8 deletions verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,15 @@ func TestVerifyBlockFilter(t *testing.T) {
},
}

// We now create two filters from our block. One that is fully valid and
// contains all the entries we require according to BIP-158 and one that
// is missing the pk scripts of the _spent_ outputs.
// We now create a filter from our block that is fully valid and
// contains all the entries we require according to BIP-158.
utxoSet := []*wire.MsgTx{prevTx}
validFilter := filterFromBlock(t, utxoSet, spendBlock, true)
invalidFilter := filterFromBlock(t, utxoSet, spendBlock, false)
b := btcutil.NewBlock(spendBlock)

opReturnValid, err := VerifyBasicBlockFilter(validFilter, b)
require.NoError(t, err)
require.Equal(t, 1, opReturnValid)

opReturnInvalid, err := VerifyBasicBlockFilter(invalidFilter, b)
require.Error(t, err)
require.Equal(t, 0, opReturnInvalid)
}

func filterFromBlock(t *testing.T, utxoSet []*wire.MsgTx,
Expand Down

0 comments on commit 1f53451

Please sign in to comment.