Skip to content

Commit d5d2d3e

Browse files
author
algoidan
committed
refactor + make the test parallel again
1 parent 349b0be commit d5d2d3e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

crypto/merklearray/proof.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ func (p *SingleLeafProof) ToProof() *Proof {
8484
}
8585

8686
// GetConcatenatedProof concats the verification path to a single slice
87-
// This function converts an empty element (i.e has missing child)
88-
// into a sequence of 0s [0...0]
87+
// This function converts an empty element in the path (i.e occurs when the tree is not a full tree)
88+
// into a sequence of digest result of zero.
8989
func (p *SingleLeafProof) GetConcatenatedProof() []byte {
9090
digestSize := p.HashFactory.NewHash().Size()
9191
proofconcat := make([]byte, digestSize*int(p.TreeDepth))
9292
for i := 0; i < int(p.TreeDepth); i++ {
93-
copy(proofconcat[i*digestSize:(i+1)*digestSize], p.Path[i])
93+
if p.Path[i] != nil {
94+
copy(proofconcat[i*digestSize:(i+1)*digestSize], p.Path[i])
95+
}
9496
}
9597
return proofconcat
9698
}

test/e2e-go/features/transactions/proof_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func TestTxnMerkleProof(t *testing.T) {
5050
partitiontest.PartitionTest(t)
5151
defer fixtures.ShutdownSynchronizedTest(t)
5252

53+
t.Parallel()
5354
a := require.New(fixtures.SynchronizedTest(t))
5455

5556
var fixture fixtures.RestClientFixture

0 commit comments

Comments
 (0)