diff --git a/crypto/merklearray/proof.go b/crypto/merklearray/proof.go index d469059b9a..ed05b76e66 100644 --- a/crypto/merklearray/proof.go +++ b/crypto/merklearray/proof.go @@ -84,13 +84,15 @@ func (p *SingleLeafProof) ToProof() *Proof { } // GetConcatenatedProof concats the verification path to a single slice -// This function converts an empty element (i.e has missing child) -// into a sequence of 0s [0...0] +// This function converts an empty element in the path (i.e occurs when the tree is not a full tree) +// into a sequence of digest result of zero. func (p *SingleLeafProof) GetConcatenatedProof() []byte { digestSize := p.HashFactory.NewHash().Size() proofconcat := make([]byte, digestSize*int(p.TreeDepth)) for i := 0; i < int(p.TreeDepth); i++ { - copy(proofconcat[i*digestSize:(i+1)*digestSize], p.Path[i]) + if p.Path[i] != nil { + copy(proofconcat[i*digestSize:(i+1)*digestSize], p.Path[i]) + } } return proofconcat } diff --git a/test/e2e-go/features/transactions/proof_test.go b/test/e2e-go/features/transactions/proof_test.go index a7b24da506..db6d1ccd4d 100644 --- a/test/e2e-go/features/transactions/proof_test.go +++ b/test/e2e-go/features/transactions/proof_test.go @@ -50,6 +50,7 @@ func TestTxnMerkleProof(t *testing.T) { partitiontest.PartitionTest(t) defer fixtures.ShutdownSynchronizedTest(t) + t.Parallel() a := require.New(fixtures.SynchronizedTest(t)) var fixture fixtures.RestClientFixture