DERO-HE STARGATE Testnet Release32

This commit is contained in:
Captain 2021-11-29 11:04:03 +00:00
parent 484639b7b9
commit 2388bdd2f0
No known key found for this signature in database
GPG Key ID: 18CDB3ED5E85D2D4
3 changed files with 15 additions and 14 deletions

View File

@ -868,10 +868,6 @@ func (chain *Blockchain) Add_Complete_Block(cbl *block.Complete_Block) (err erro
if bl_current.Height == 0 { // if it's genesis block if bl_current.Height == 0 { // if it's genesis block
if ss, err = chain.Store.Balance_store.LoadSnapshot(0); err != nil { if ss, err = chain.Store.Balance_store.LoadSnapshot(0); err != nil {
panic(err) panic(err)
} else if balance_tree, err = ss.GetTree(config.BALANCE_TREE); err != nil {
panic(err)
} else if sc_meta, err = ss.GetTree(config.SC_META); err != nil {
panic(err)
} }
} else { // we already have a block before us, use it } else { // we already have a block before us, use it
@ -886,14 +882,13 @@ func (chain *Blockchain) Add_Complete_Block(cbl *block.Complete_Block) (err erro
if err != nil { if err != nil {
panic(err) panic(err)
} }
}
if balance_tree, err = ss.GetTree(config.BALANCE_TREE); err != nil { if balance_tree, err = ss.GetTree(config.BALANCE_TREE); err != nil {
panic(err) panic(err)
} }
if sc_meta, err = ss.GetTree(config.SC_META); err != nil { if sc_meta, err = ss.GetTree(config.SC_META); err != nil {
panic(err) panic(err)
} }
}
fees_collected := uint64(0) fees_collected := uint64(0)

View File

@ -59,6 +59,7 @@ func (s *storefs) ReadBlock(h [32]byte) ([]byte, error) {
return nil, os.ErrNotExist return nil, os.ErrNotExist
} }
// on windows, we see an odd behaviour where some files could not be deleted, since they may exist only in cache
func (s *storefs) DeleteBlock(h [32]byte) error { func (s *storefs) DeleteBlock(h [32]byte) error {
dir := filepath.Join(filepath.Join(s.basedir, "bltx_store"), fmt.Sprintf("%02x", h[0]), fmt.Sprintf("%02x", h[1]), fmt.Sprintf("%02x", h[2])) dir := filepath.Join(filepath.Join(s.basedir, "bltx_store"), fmt.Sprintf("%02x", h[0]), fmt.Sprintf("%02x", h[1]), fmt.Sprintf("%02x", h[2]))
@ -74,7 +75,7 @@ func (s *storefs) DeleteBlock(h [32]byte) error {
file := filepath.Join(filepath.Join(s.basedir, "bltx_store"), fmt.Sprintf("%02x", h[0]), fmt.Sprintf("%02x", h[1]), fmt.Sprintf("%02x", h[2]), file.Name()) file := filepath.Join(filepath.Join(s.basedir, "bltx_store"), fmt.Sprintf("%02x", h[0]), fmt.Sprintf("%02x", h[1]), fmt.Sprintf("%02x", h[2]), file.Name())
err = os.Remove(file) err = os.Remove(file)
if err != nil { if err != nil {
return err //return err
} }
found = true found = true
} }
@ -123,10 +124,15 @@ func (chain *Blockchain) ReadBlockSnapshotVersion(h [32]byte) (uint64, error) {
func (s *storefs) ReadBlockSnapshotVersion(h [32]byte) (uint64, error) { func (s *storefs) ReadBlockSnapshotVersion(h [32]byte) (uint64, error) {
dir := filepath.Join(filepath.Join(s.basedir, "bltx_store"), fmt.Sprintf("%02x", h[0]), fmt.Sprintf("%02x", h[1]), fmt.Sprintf("%02x", h[2])) dir := filepath.Join(filepath.Join(s.basedir, "bltx_store"), fmt.Sprintf("%02x", h[0]), fmt.Sprintf("%02x", h[1]), fmt.Sprintf("%02x", h[2]))
files, err := os.ReadDir(dir) files, err := os.ReadDir(dir) // this always returns the sorted list
if err != nil { if err != nil {
return 0, err return 0, err
} }
// windows has a caching issue, so earlier versions may exist at the same time
// so we mitigate it, by using the last version, below 3 lines reverse the already sorted arrray
for left, right := 0, len(files)-1; left < right; left, right = left+1, right-1 {
files[left], files[right] = files[right], files[left]
}
filename_start := fmt.Sprintf("%x.block", h[:]) filename_start := fmt.Sprintf("%x.block", h[:])
for _, file := range files { for _, file := range files {

View File

@ -20,4 +20,4 @@ import "github.com/blang/semver/v4"
// right now it has to be manually changed // right now it has to be manually changed
// do we need to include git commitsha?? // do we need to include git commitsha??
var Version = semver.MustParse("3.4.92-1.DEROHE.STARGATE+25112021") var Version = semver.MustParse("3.4.93-1.DEROHE.STARGATE+25112021")