forked from TrueCloudLab/frostfs-contract
[#7] Refactor common.CheckAlphabetWitness()
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
d8530284fd
commit
b9be2ac036
8 changed files with 27 additions and 43 deletions
|
@ -140,7 +140,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
|
|||
func AddPeerIR(nodeInfo []byte) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.CheckAlphabetWitness(common.AlphabetAddress())
|
||||
common.CheckAlphabetWitness()
|
||||
|
||||
publicKey := nodeInfo[2:35] // V2 format: offset:2, len:33
|
||||
|
||||
|
@ -213,7 +213,7 @@ func UpdateState(state NodeState, publicKey interop.PublicKey) {
|
|||
ctx := storage.GetContext()
|
||||
|
||||
common.CheckWitness(publicKey)
|
||||
common.CheckAlphabetWitness(common.AlphabetAddress())
|
||||
common.CheckAlphabetWitness()
|
||||
|
||||
updateCandidateState(ctx, publicKey, state)
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ func UpdateState(state NodeState, publicKey interop.PublicKey) {
|
|||
func UpdateStateIR(state NodeState, publicKey interop.PublicKey) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.CheckAlphabetWitness(common.AlphabetAddress())
|
||||
common.CheckAlphabetWitness()
|
||||
|
||||
updateCandidateState(ctx, publicKey, state)
|
||||
}
|
||||
|
@ -244,8 +244,7 @@ func UpdateStateIR(state NodeState, publicKey interop.PublicKey) {
|
|||
func NewEpoch(epochNum int) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
multiaddr := common.AlphabetAddress()
|
||||
common.CheckAlphabetWitness(multiaddr)
|
||||
common.CheckAlphabetWitness()
|
||||
|
||||
currentEpoch := storage.Get(ctx, snapshotEpoch).(int)
|
||||
if epochNum <= currentEpoch {
|
||||
|
@ -343,7 +342,7 @@ func getSnapshotCount(ctx storage.Context) int {
|
|||
//
|
||||
// Count MUST NOT be negative.
|
||||
func UpdateSnapshotCount(count int) {
|
||||
common.CheckAlphabetWitness(common.AlphabetAddress())
|
||||
common.CheckAlphabetWitness()
|
||||
if count < 0 {
|
||||
panic("count must be positive")
|
||||
}
|
||||
|
@ -443,8 +442,7 @@ func Config(key []byte) interface{} {
|
|||
func SetConfig(id, key, val []byte) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
multiaddr := common.AlphabetAddress()
|
||||
common.CheckAlphabetWitness(multiaddr)
|
||||
common.CheckAlphabetWitness()
|
||||
|
||||
setConfig(ctx, key, val)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue