-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dot/rpc: Implement RPC system_name, system_version, system_chain #849
Changes from all commits
e96cd7c
03e7c12
b344113
30fa146
d04e7e6
9c387a8
2f0d66c
0a2d663
9435349
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,21 +24,22 @@ import ( | |
"reflect" | ||
"unicode" | ||
|
||
"github.com/ChainSafe/gossamer/dot/types" | ||
"github.com/ChainSafe/gossamer/node/gssmr" | ||
"github.com/ChainSafe/gossamer/node/ksmcc" | ||
|
||
log "github.com/ChainSafe/log15" | ||
"github.com/naoina/toml" | ||
) | ||
|
||
// Config is a collection of configurations throughout the system | ||
type Config struct { | ||
Global GlobalConfig `toml:"global"` | ||
Init InitConfig `toml:"init"` | ||
Account AccountConfig `toml:"account"` | ||
Core CoreConfig `toml:"core"` | ||
Network NetworkConfig `toml:"network"` | ||
RPC RPCConfig `toml:"rpc"` | ||
Global GlobalConfig `toml:"global"` | ||
Init InitConfig `toml:"init"` | ||
Account AccountConfig `toml:"account"` | ||
Core CoreConfig `toml:"core"` | ||
Network NetworkConfig `toml:"network"` | ||
RPC RPCConfig `toml:"rpc"` | ||
System types.SystemInfo `toml:"-"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this exclude it from the config file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. |
||
} | ||
|
||
// GlobalConfig is to marshal/unmarshal toml global config vars | ||
|
@@ -132,6 +133,10 @@ func GssmrConfig() *Config { | |
Modules: gssmr.DefaultRPCModules, | ||
WSPort: gssmr.DefaultRPCWSPort, | ||
}, | ||
System: types.SystemInfo{ | ||
NodeName: gssmr.DefaultName, | ||
SystemProperties: make(map[string]interface{}), | ||
}, | ||
} | ||
} | ||
|
||
|
@@ -167,6 +172,10 @@ func KsmccConfig() *Config { | |
Modules: ksmcc.DefaultRPCModules, | ||
WSPort: ksmcc.DefaultRPCWSPort, | ||
}, | ||
System: types.SystemInfo{ | ||
NodeName: ksmcc.DefaultName, | ||
SystemProperties: make(map[string]interface{}), | ||
}, | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,13 +235,19 @@ func NewNode(cfg *Config, ks *keystore.Keystore) (*Node, error) { | |
|
||
} | ||
|
||
// System Service | ||
|
||
// create system service and append to node services | ||
sysSrvc := createSystemService(&cfg.System) | ||
nodeSrvcs = append(nodeSrvcs, sysSrvc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
// RPC Service | ||
|
||
// check if rpc service is enabled | ||
if enabled := RPCServiceEnabled(cfg); enabled { | ||
|
||
// create rpc service and append rpc service to node services | ||
rpcSrvc := createRPCService(cfg, stateSrvc, coreSrvc, networkSrvc, rt) | ||
rpcSrvc := createRPCService(cfg, stateSrvc, coreSrvc, networkSrvc, rt, sysSrvc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
nodeSrvcs = append(nodeSrvcs, rpcSrvc) | ||
|
||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this intentionally moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, maybe my IDE did it when I did goimports? not sure.