gcs/builder: fix tests by rebuilding filter, making failure to match fatal
This commit is contained in:
parent
dabaf053db
commit
03a7f9b01f
1 changed files with 7 additions and 3 deletions
|
@ -261,7 +261,7 @@ func BuilderTest(b *builder.GCSBuilder, hash *chainhash.Hash, p uint8,
|
||||||
}
|
}
|
||||||
pushedData, err := txscript.PushedData(addrBytes)
|
pushedData, err := txscript.PushedData(addrBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't extract pushed data from addrBytesess script: %s",
|
t.Fatalf("Couldn't extract pushed data from addrBytes script: %s",
|
||||||
err.Error())
|
err.Error())
|
||||||
}
|
}
|
||||||
match, err = f.MatchAny(key, pushedData)
|
match, err = f.MatchAny(key, pushedData)
|
||||||
|
@ -269,17 +269,21 @@ func BuilderTest(b *builder.GCSBuilder, hash *chainhash.Hash, p uint8,
|
||||||
t.Fatalf("Filter match any failed: %s", err)
|
t.Fatalf("Filter match any failed: %s", err)
|
||||||
}
|
}
|
||||||
if !match {
|
if !match {
|
||||||
t.Logf("Filter didn't match when it should have!")
|
t.Fatal("Filter didn't match when it should have!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a routine witness stack, build a filter, and test that it
|
// Add a routine witness stack, build a filter, and test that it
|
||||||
// matches.
|
// matches.
|
||||||
b.AddWitness(witness)
|
b.AddWitness(witness)
|
||||||
|
f, err = b.Build()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Filter build failed: %s", err.Error())
|
||||||
|
}
|
||||||
match, err = f.MatchAny(key, witness)
|
match, err = f.MatchAny(key, witness)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Filter match any failed: %s", err)
|
t.Fatalf("Filter match any failed: %s", err)
|
||||||
}
|
}
|
||||||
if !match {
|
if !match {
|
||||||
t.Logf("Filter didn't match when it should have!")
|
t.Fatal("Filter didn't match when it should have!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue