mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-16 11:16:30 +00:00
state: drop compatibility code for NEOBalance
A part of #3454. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
7683f4366d
commit
125f757988
3 changed files with 6 additions and 14 deletions
|
@ -25,13 +25,6 @@ APIs/commands/configurations will be removed and here is a list of scheduled
|
|||
breaking changes. Consider changing your code/scripts/configurations if you're
|
||||
using anything mentioned here.
|
||||
|
||||
## `NEOBalance` from stack item
|
||||
|
||||
We check struct items count before convert LastGasPerVote to let RPC client be compatible with
|
||||
old versions.
|
||||
|
||||
Removal of this compatiblility code is scheduled for Jun-Jul 2024.
|
||||
|
||||
## `serv_node_version` Prometheus gauge metric
|
||||
|
||||
This metric is replaced by the new `neogo_version` and `server_id` Prometheus gauge
|
||||
|
|
|
@ -133,7 +133,7 @@ func (s *NEOBalance) ToStackItem() (stackitem.Item, error) {
|
|||
// FromStackItem converts stackitem.Item to NEOBalance.
|
||||
func (s *NEOBalance) FromStackItem(item stackitem.Item) error {
|
||||
structItem, ok := item.Value().([]stackitem.Item)
|
||||
if !ok || len(structItem) < 3 {
|
||||
if !ok || len(structItem) < 4 {
|
||||
return errors.New("invalid stackitem length")
|
||||
}
|
||||
balance, err := structItem[0].TryInteger()
|
||||
|
@ -159,12 +159,10 @@ func (s *NEOBalance) FromStackItem(item stackitem.Item) error {
|
|||
}
|
||||
s.VoteTo = pub
|
||||
}
|
||||
if len(structItem) >= 4 {
|
||||
lastGasPerVote, err := structItem[3].TryInteger()
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid last vote reward per neo stackitem: %w", err)
|
||||
}
|
||||
s.LastGasPerVote = *lastGasPerVote
|
||||
lastGasPerVote, err := structItem[3].TryInteger()
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid last vote reward per neo stackitem: %w", err)
|
||||
}
|
||||
s.LastGasPerVote = *lastGasPerVote
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ func TestGetAccountState(t *testing.T) {
|
|||
stackitem.Make(100500),
|
||||
stackitem.Make(42),
|
||||
stackitem.Null{},
|
||||
stackitem.Make(0),
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue