-
Notifications
You must be signed in to change notification settings - Fork 451
/
array.go
34 lines (29 loc) · 1.44 KB
/
array.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2019-2024 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.
package merklearray
import "github.com/algorand/go-algorand/crypto"
// An Array represents a dense array of leaf elements that are
// combined into a Merkle tree. The Marshal method returns a byte slice that represents the object
// that the Tree will use to hash the leaves.
// An Array is an interface that is being using when creating Merkle trees.
// It represents a dense array of n (n is given by the Length() method) elements,
// and returns a hash representation for each leaf (in the range)
type Array interface {
// Length returns number of elements in the array.
Length() uint64
// Marshal Returns a hash representation of the element located in position pos
Marshal(pos uint64) (crypto.Hashable, error)
}