Documentation ¶
Index ¶
- Constants
- func CacheFilePath(dirPath string, epoch uint64) string
- func CalculateDatasetMerkleRoot(dagdir, cachedir string, epoch uint64, saveCache bool) (mtree.Hash, error)
- func CalculateProof(dagdir string, blockno uint64, index uint32, cache *DatasetMerkleTreeCache) (mtree.Word, []mtree.Hash, error)
- func PersistCache(dirPath string, cache *DatasetMerkleTreeCache) error
- func RLPHeader(header *types.Header) ([]byte, error)
- func RemoveEpochFile(cachedir, dagdir string, epoch uint64)
- type DatasetMerkleTreeCache
Constants ¶
View Source
const CACHE_LEVEL uint64 = 15
Variables ¶
This section is empty.
Functions ¶
func CacheFilePath ¶
func CalculateDatasetMerkleRoot ¶
func CalculateDatasetMerkleRoot(dagdir, cachedir string, epoch uint64, saveCache bool) (mtree.Hash, error)
- Generate the dataset if needed
- Build merkle tree
- If saveCache is true, save root merkle tree of 10 levels to disk
- Return merkle root
func CalculateProof ¶
func PersistCache ¶
func PersistCache(dirPath string, cache *DatasetMerkleTreeCache) error
func RemoveEpochFile ¶
Types ¶
type DatasetMerkleTreeCache ¶
type DatasetMerkleTreeCache struct { Epoch uint64 `json:"epoch"` ProofLength uint64 `json:"proof_length"` CacheLength uint64 `json:"cache_length"` RootHash mtree.Hash `json:"root_hash"` Proofs [][]mtree.Hash `json:"proofs"` }
func (*DatasetMerkleTreeCache) Print ¶
func (self *DatasetMerkleTreeCache) Print()
Click to show internal directories.
Click to hide internal directories.