MCPcopy
hub / github.com/hyperledger/fabric / TestGetProposalHash2

Function TestGetProposalHash2

protoutil/txutils_test.go:479–492  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

477}
478
479func TestGetProposalHash2(t *testing.T) {
480 expectedHashHex := "7b622ef4e1ab9b7093ec3bbfbca17d5d6f14a437914a6839319978a7034f7960"
481 expectedHash, _ := hex.DecodeString(expectedHashHex)
482 hdr := &cb.Header{
483 ChannelHeader: []byte("chdr"),
484 SignatureHeader: []byte("shdr"),
485 }
486 propHash, err := protoutil.GetProposalHash2(hdr, []byte("ccproppayload"))
487 require.NoError(t, err, "Unexpected error getting hash2 for proposal")
488 require.Equal(t, expectedHash, propHash, "Proposal hash did not match expected hash")
489
490 _, err = protoutil.GetProposalHash2(&cb.Header{}, []byte("ccproppayload"))
491 require.Error(t, err, "Expected error with nil arguments")
492}
493
494func TestGetProposalHash1(t *testing.T) {
495 expectedHashHex := "d4c1e3cac2105da5fddc2cfe776d6ec28e4598cf1e6fa51122c7f70d8076437b"

Callers

nothing calls this directly

Calls 4

GetProposalHash2Function · 0.92
DecodeStringMethod · 0.80
ErrorMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected