@@ -256,6 +256,42 @@ func assertEqualProof(t *testing.T, expected, actual *Proof) {
256256 )
257257}
258258
259+ // TestProofEncodingGroupKeyRevealV1 tests encoding and decoding a proof with a
260+ // group key reveal V1.
261+ func TestProofEncodingGroupKeyRevealV1 (t * testing.T ) {
262+ t .Parallel ()
263+
264+ testBlocks := readTestData (t )
265+ oddTxBlock := testBlocks [0 ]
266+
267+ genesis := asset .RandGenesis (t , asset .Normal )
268+ scriptKey := test .RandPubKey (t )
269+ proof := RandProof (t , genesis , scriptKey , oddTxBlock , 0 , 1 )
270+
271+ // Override the group key reveal with a V1 reveal.
272+ internalKey := test .RandPubKey (t )
273+ customRoot := chainhash .Hash (test .RandBytes (32 ))
274+ groupKeyReveal , err := asset .NewGroupKeyRevealV1 (
275+ * internalKey , genesis .ID (), fn .Some (customRoot ),
276+ )
277+ require .NoError (t , err )
278+
279+ proof .GroupKeyReveal = & groupKeyReveal
280+
281+ file , err := NewFile (V0 , proof , proof )
282+ require .NoError (t , err )
283+ proof .AdditionalInputs = []File {* file , * file }
284+
285+ var proofBuf bytes.Buffer
286+ require .NoError (t , proof .Encode (& proofBuf ))
287+ proofBytes := proofBuf .Bytes ()
288+
289+ var decodedProof Proof
290+ require .NoError (t , decodedProof .Decode (bytes .NewReader (proofBytes )))
291+
292+ assertEqualProof (t , & proof , & decodedProof )
293+ }
294+
259295func TestProofEncoding (t * testing.T ) {
260296 t .Parallel ()
261297
0 commit comments