Skip to content

Commit

Permalink
Release74: Sync issues and other minor bugs fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainDero committed May 9, 2022
1 parent 607af6d commit b660adf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
14 changes: 14 additions & 0 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,20 @@ func Blockchain_Start(params map[string]interface{}) (*Blockchain, error) {

chain.Initialise_Chain_From_DB() // load the chain from the disk

try_again:
version, err := chain.ReadBlockSnapshotVersion(chain.Get_Top_ID())
if err != nil {
panic(err)
}
// this case happens when chain syncs from rsync and if rsync takes more time than block_time
// basically this can also be fixed, if topo.map file is renamed to name starting with 'a'
// it should be the first file to be synced, but instead of renaming file as fix
// we are fixing it by checking how much we have progressed and skip those block
if _, err = chain.Load_Merkle_Hash(version); err != nil {
chain.Rewind_Chain(1) // rewind 1 block
goto try_again
}

if chain.Pruned >= 1 {
logger.Info("Chain Pruned till", "topoheight", chain.Pruned)
}
Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ import "github.com/blang/semver/v4"

// right now it has to be manually changed
// do we need to include git commitsha??
var Version = semver.MustParse("3.4.141-73.DEROHE.STARGATE+26022022")
var Version = semver.MustParse("3.4.141-74.DEROHE.STARGATE+26022022")
24 changes: 23 additions & 1 deletion p2p/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ func P2P_Init(params map[string]interface{}) error {
logger.Info("", "BW_FACTOR", bw_factor)
}

if os.Getenv("UDP_READ_BUF_CONN") != "" {
size, _ := strconv.Atoi(os.Getenv("UDP_READ_BUF_CONN"))
if size <= 64*1024 {
size = 64 * 1024
}
logger.Info("", "UDP_READ_BUF_CONN", size)
}

// permanently unban any seed nodes
if globals.IsMainnet() {
for i := range config.Mainnet_seed_nodes {
Expand Down Expand Up @@ -271,6 +279,20 @@ func tunekcp(conn *kcp.UDPSession) {
} else {
conn.SetNoDelay(0, 40, 0, 0) // tuning paramters for local
}

size := 1 * 1024 * 1024 // set the buffer size max possible upto 1 MB, default is 1 MB
if os.Getenv("UDP_READ_BUF_CONN") != "" {
size, _ = strconv.Atoi(os.Getenv("UDP_READ_BUF_CONN"))
if size <= 64*1024 {
size = 64 * 1024
}
}
for size >= 64*1024 {
if err := conn.SetReadBuffer(size); err == nil {
break
}
size = size - (64 * 1024)
}
}

// will try to connect with given endpoint
Expand Down Expand Up @@ -617,7 +639,7 @@ func getc(client *rpc2.Client) *Connection {
if ci, found := client.State.Get("c"); found {
return ci.(*Connection)
} else {
panic("no connection attached")
//panic("no connection attached") // automatically handled by higher layers
return nil
}
}
Expand Down

0 comments on commit b660adf

Please sign in to comment.