@@ -939,6 +939,31 @@ func runBIPTestVector(t *testing.T, testVectors *TestVectors) {
939939 buf .Bytes (),
940940 )
941941
942+ // Make sure the proof in the test vectors doesn't use
943+ // a record type we haven't marked as known/supported
944+ // yet. If the following check fails, you need to update
945+ // the KnownProofTypes set.
946+ for _ , record := range p .EncodeRecords () {
947+ require .Contains (
948+ tt , KnownProofTypes , record .Type (),
949+ )
950+ }
951+
952+ checkTaprootProofTypes (tt , p .InclusionProof )
953+ for i := range p .ExclusionProofs {
954+ checkTaprootProofTypes (tt , p .ExclusionProofs [i ])
955+ }
956+
957+ if p .MetaReveal != nil {
958+ metaRecords := p .MetaReveal .EncodeRecords ()
959+ for _ , records := range metaRecords {
960+ require .Contains (
961+ tt , KnownMetaRevealTypes ,
962+ records .Type (),
963+ )
964+ }
965+ }
966+
942967 // Create nice diff if things don't match.
943968 if ! areEqual {
944969 expectedProof := & Proof {}
@@ -986,6 +1011,48 @@ func runBIPTestVector(t *testing.T, testVectors *TestVectors) {
9861011 }
9871012}
9881013
1014+ // checkTaprootProofTypes ensures that the taproot proof contains only known
1015+ // TLV types.
1016+ func checkTaprootProofTypes (t * testing.T , p TaprootProof ) {
1017+ for _ , record := range p .EncodeRecords () {
1018+ require .Contains (t , KnownTaprootProofTypes , record .Type ())
1019+ }
1020+
1021+ if p .CommitmentProof != nil {
1022+ for _ , record := range p .CommitmentProof .EncodeRecords () {
1023+ require .Contains (
1024+ t , KnownCommitmentProofTypes , record .Type (),
1025+ )
1026+
1027+ tap := p .CommitmentProof .TaprootAssetProof
1028+ types := commitment .KnownTaprootAssetProofTypes
1029+ for _ , record := range tap .Records () {
1030+ require .Contains (
1031+ t , types , record .Type (),
1032+ )
1033+ }
1034+
1035+ if p .CommitmentProof .AssetProof != nil {
1036+ ap := p .CommitmentProof .AssetProof
1037+ types := commitment .KnownAssetProofTypes
1038+ for _ , record := range ap .Records () {
1039+ require .Contains (
1040+ t , types , record .Type (),
1041+ )
1042+ }
1043+ }
1044+ }
1045+ }
1046+
1047+ if p .TapscriptProof != nil {
1048+ for _ , record := range p .TapscriptProof .EncodeRecords () {
1049+ require .Contains (
1050+ t , KnownTapscriptProofTypes , record .Type (),
1051+ )
1052+ }
1053+ }
1054+ }
1055+
9891056func init () {
9901057 logWriter := build .NewRotatingLogWriter ()
9911058 logger := logWriter .GenSubLogger (Subsystem , func () {})
0 commit comments