1. Remove eth rpc code and unnecessary changes from
7a0f18f92b. Import the package instead.
2. Move HmyAPIBackend into core package so it has more access to core.
3. Add API interface for services.
4. Start RPC for all roles, for both HTTP (baseport+10) and WS (baseport+20).
3. Keep implemented APIs but move to internal/hmyapi package.
utilize go:generate to convert the default wallet.ini file
into go constant `defaultWalletIni` defined in
`cmd/client/wallet/generated_ini.go` which will be used when
`.hmy/wallet.ini` doesn't exist under the current filesystem.
They add call site information (function name, filename, line number) to
a logger.
GetLogger is intended for direct one-shot logging calls, i.e.
“GetLogger().Debug(...)”.
Wrap reusable loggers with WithCaller():
logger := utils.GetLogInstance().New(/* ... */)
/* ... */
utils.WithCaller(logger).Debug(/* ... */)
Or use a local getLogger() idiom:
logger := utils.GetLogInstance().New(/* ... */)
getLogger := func() log.Logger {
return WithCallerSkip(logger, 1)
}
/* ... */
getLogger().Debug(/* ... */)
Since getLogger() uses closure, logger can later be augmented with
“logger = logger.New(/* ... */)” syntax.
use an external environment variable to specify the rpc servers
of the wallet. this will greatly simplify the testing.
example of the environment variable:
export RpcNodes="127.0.0.1:8989,192.168.129.1:5555"
Signed-off-by: Leo Chen <leo@harmony.one>
The main problem is the wallet is using p2p for async communication and
it exits too fast before p2p finished the tasks.
So, we added a few seconds waiting in the program and it works fine.
Signed-off-by: Leo Chen <leo@harmony.one>
We experienced a few cases that node failed to connect to bootnode and
the node program will not be useable. So, we add a retry mechanism to
increase the connection times to bootnode.
Signed-off-by: Leo Chen <leo@harmony.one>
This is to stay compliant
https://github.com/golang-standards/project-layout/tree/master/cmd, to
quote which:
“Don't put a lot of code in the application directory. If you think the
code can be imported and used in other projects, then it should live in
the /pkg directory. If the code is not reusable or if you don't want
others to reuse it, put that code in the /internal directory.”