mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-27 22:28:21 +00:00
6464da7670
* save state * save state * save state * refactoring * fix * save state * save state * fmt * fix lint * restore torrents for external downloader * fix lint * download * skip debug test * debug * remote debug * small cli fixes * skip debug test * external snapshot predownloader * get rid of remote downloader * fix lint * clean makefile * fix lint * fix lint * cleanup * fix ci * fmt * remove proto from interfaces * Squashed 'interfaces/' content from commit acd02bb94 git-subtree-dir: interfaces git-subtree-split: acd02bb94c5a421aa8f8d1fd76cd8aad668e9fcb
27 lines
533 B
Go
27 lines
533 B
Go
package generate
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/anacrolix/torrent/bencode"
|
|
"github.com/anacrolix/torrent/metainfo"
|
|
"github.com/ledgerwatch/turbo-geth/turbo/snapshotsync/bittorrent"
|
|
"time"
|
|
)
|
|
|
|
func MetaInfoHash(path string) error {
|
|
t := time.Now()
|
|
mi := metainfo.MetaInfo{}
|
|
info, err := bittorrent.BuildInfoBytesForLMDBSnapshot(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
mi.InfoBytes, err = bencode.Marshal(info)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println(mi.HashInfoBytes())
|
|
fmt.Println("It took", time.Since(t))
|
|
return nil
|
|
}
|