forked from TrueCloudLab/neoneo-go
core: improve documentation to SetOracle/SetNotary
I've carefully checked the way how new service can be added to the Blockchain instance or to be removed from it. Current implemention of SetNotary and SetOracle methods doesn't contain dangerous code, and native contracts have atomic values everywhere where service is stored. Current implementation of Notary, Oracle and StateRoot services' reload/disabling/enabling on SIGUSR1 is safe and doesn't require any adjustment. This commit closes #2944, it's not a bug in the code, it's just stale documentation. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
d5f964f181
commit
c880873105
1 changed files with 4 additions and 4 deletions
|
@ -328,8 +328,8 @@ func NewBlockchain(s storage.Store, cfg config.Blockchain, log *zap.Logger) (*Bl
|
||||||
return bc, nil
|
return bc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOracle sets oracle module. It doesn't protected by mutex and
|
// SetOracle sets oracle module. It can safely be called on the running blockchain.
|
||||||
// must be called before `bc.Run()` to avoid data race.
|
// To unregister Oracle service use SetOracle(nil).
|
||||||
func (bc *Blockchain) SetOracle(mod native.OracleService) {
|
func (bc *Blockchain) SetOracle(mod native.OracleService) {
|
||||||
orc := bc.contracts.Oracle
|
orc := bc.contracts.Oracle
|
||||||
if mod != nil {
|
if mod != nil {
|
||||||
|
@ -356,8 +356,8 @@ func (bc *Blockchain) SetOracle(mod native.OracleService) {
|
||||||
bc.contracts.Designate.OracleService.Store(&mod)
|
bc.contracts.Designate.OracleService.Store(&mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNotary sets notary module. It doesn't protected by mutex and
|
// SetNotary sets notary module. It may safely be called on the running blockchain.
|
||||||
// must be called before `bc.Run()` to avoid data race.
|
// To unregister Notary service use SetNotary(nil).
|
||||||
func (bc *Blockchain) SetNotary(mod native.NotaryService) {
|
func (bc *Blockchain) SetNotary(mod native.NotaryService) {
|
||||||
if mod != nil {
|
if mod != nil {
|
||||||
keys, _, err := bc.contracts.Designate.GetDesignatedByRole(bc.dao, noderoles.P2PNotary, bc.BlockHeight())
|
keys, _, err := bc.contracts.Designate.GetDesignatedByRole(bc.dao, noderoles.P2PNotary, bc.BlockHeight())
|
||||||
|
|
Loading…
Reference in a new issue