Skip to content
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

verification: skip checking input scripts #234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this will undoubtedly lead to questions/issues, should we add something along the lines of "might contain taproot outputs which aren't supported yet"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea. will add 👍

"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