Skip to content

Commit

Permalink
refactor + make the test parallel again
Browse files Browse the repository at this point in the history
  • Loading branch information
algoidan committed Feb 21, 2022
1 parent 349b0be commit d5d2d3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crypto/merklearray/proof.go
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions test/e2e-go/features/transactions/proof_test.go
Expand Up @@ -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
Expand Down

0 comments on commit d5d2d3e

Please sign in to comment.