// MerkleHash returns the merkle hash of the vnode.
MerkleHash returns the merkle hash of the vnode.
// MerkleHash returns the merkle hash of the vnode .
func (vn *VNode) MerkleHash() string {
	if !vn.IsDir() {
		return utils.HashStrToHex(vn.Source.Checksum)
	}
	if len(vn.Links) == 0 {
		return ""
	}
	vn.SortLinksByID()
	var hashSum string
	var wg sync.WaitGroup
	for _, vnode := range vn.Links {
		wg.Add(1)
		go func(vnode *VNode) {
			merkleHash := vnode.MerkleHash()
			hashSum += merkleHash
			wg.Done()
		}(vnode)
	}
	wg.Wait()
	return utils.HashStrToHex(hashSum)
}
func ( vn * VNode ) MerkleHash ( ) string { if ! vn . IsDir ( ) { return utils . HashStrToHex ( vn . Source . Checksum ) } if len ( vn . Links ) == 0 { return " " } vn . SortLinksByID ( ) var hashSum string var wg sync . WaitGroup for _ , vnode := range vn . Links { wg . Add ( 1 ) go func ( vnode * VNode ) { merkleHash := vnode . MerkleHash ( ) hashSum += merkleHash wg . Done ( ) } ( vnode ) } wg . Wait ( ) return utils . HashStrToHex ( hashSum ) }
MerkleHash returns the merkle hash of the vnode.
MerkleHash returns the merkle hash of the vnode .