From 9982adeb03d6545d780d08275e58daeadecda165 Mon Sep 17 00:00:00 2001 From: Dev-JamesR Date: Thu, 11 Feb 2021 15:49:54 +0000 Subject: [PATCH] Misc Bug Fixes, Efficiency Updates --- ethofs/blockchain.go | 15 +++++++++++---- ethofs/ethofs.go | 5 +++++ params/version.go | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ethofs/blockchain.go b/ethofs/blockchain.go index a8f70d80d..209b995a4 100644 --- a/ethofs/blockchain.go +++ b/ethofs/blockchain.go @@ -18,6 +18,7 @@ import ( var pinResponseFlag = false var pinResponseCount = uint64(10) +var ethClient *ethclient.Client func checkPinResponse(pinNumber uint64) { if pinNumber >= pinResponseCount { @@ -25,15 +26,21 @@ func checkPinResponse(pinNumber uint64) { } } +func initializeEthClient() error { + c, err := ethclient.Dial(ipcLocation) + if err != nil { + return err + } + ethClient = c + return nil +} + func updatePinContractValues() error { if(pinResponseFlag) { return nil // Returning as pin response collection still in process } - c, err := ethclient.Dial(ipcLocation) - if err != nil { - return err - } + c := ethClient address := common.HexToAddress("0xD3b80c611999D46895109d75322494F7A49D742F") contract, err := NewPinStorage(address, c) diff --git a/ethofs/ethofs.go b/ethofs/ethofs.go index 35141fa1b..700e5ba8d 100644 --- a/ethofs/ethofs.go +++ b/ethofs/ethofs.go @@ -50,6 +50,11 @@ func InitializeEthofs(initFlag bool, configFlag bool, nodeType string, blockComm ipcLocation = defaultDataDir + "/geth.ipc" } + clientErr := initializeEthClient() + if clientErr != nil { + os.Exit(0) + } + if initFlag { log.Info("Starting ethoFS repo initialization") diff --git a/params/version.go b/params/version.go index 358608a4e..12d19d20b 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 4 // Minor version component of the current release - VersionPatch = 4 // Patch version component of the current release + VersionPatch = 5 // Patch version component of the current release VersionMeta = "Ether1-Kepler" // Version metadata to append to the version string )