mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-01 23:40:35 +00:00
core: fix extensible sender check
Looks like it was wrong since 9592f3e052
because
sort.Search can return an index that is not equal to the target.
slices.BinarySearchFunc can do that too, but it also return a very convenient
boolean status that can be used.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
74acfe5288
commit
5431b31d84
1 changed files with 3 additions and 2 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sort"
|
"sort"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
@ -1854,8 +1855,8 @@ func (bc *Blockchain) updateExtensibleList(s *[]util.Uint160, pubs keys.PublicKe
|
||||||
// IsExtensibleAllowed determines if script hash is allowed to send extensible payloads.
|
// IsExtensibleAllowed determines if script hash is allowed to send extensible payloads.
|
||||||
func (bc *Blockchain) IsExtensibleAllowed(u util.Uint160) bool {
|
func (bc *Blockchain) IsExtensibleAllowed(u util.Uint160) bool {
|
||||||
us := bc.extensible.Load().([]util.Uint160)
|
us := bc.extensible.Load().([]util.Uint160)
|
||||||
n := sort.Search(len(us), func(i int) bool { return !us[i].Less(u) })
|
_, ok := slices.BinarySearchFunc(us, u, util.Uint160.Compare)
|
||||||
return n < len(us)
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *Blockchain) runPersist(script []byte, block *block.Block, cache *dao.Simple, trig trigger.Type, v *vm.VM) (*state.AppExecResult, *vm.VM, error) {
|
func (bc *Blockchain) runPersist(script []byte, block *block.Block, cache *dao.Simple, trig trigger.Type, v *vm.VM) (*state.AppExecResult, *vm.VM, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue