forked from TrueCloudLab/neoneo-go
Merge pull request #2838 from nspcc-dev/neo-misuse
*: fix Neo and NeoGo misuses
This commit is contained in:
commit
199a6de737
21 changed files with 37 additions and 37 deletions
|
@ -84,7 +84,7 @@ func NewCommands() []cli.Command {
|
||||||
return []cli.Command{
|
return []cli.Command{
|
||||||
{
|
{
|
||||||
Name: "node",
|
Name: "node",
|
||||||
Usage: "start a NEO node",
|
Usage: "start a NeoGo node",
|
||||||
UsageText: "neo-go node [--config-path path] [-d] [-p/-m/-t]",
|
UsageText: "neo-go node [--config-path path] [-d] [-p/-m/-t]",
|
||||||
Action: startServer,
|
Action: startServer,
|
||||||
Flags: cfgFlags,
|
Flags: cfgFlags,
|
||||||
|
@ -673,7 +673,7 @@ func initBlockChain(cfg config.Config, log *zap.Logger) (*core.Blockchain, stora
|
||||||
return chain, store, nil
|
return chain, store, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logo returns Neo-Go logo.
|
// Logo returns NeoGo logo.
|
||||||
func Logo() string {
|
func Logo() string {
|
||||||
return `
|
return `
|
||||||
_ ____________ __________
|
_ ____________ __________
|
||||||
|
|
|
@ -434,7 +434,7 @@ func NewWithConfig(printLogotype bool, onExit func(int), c *readline.Config, cfg
|
||||||
ctl.Writer = l.Stdout()
|
ctl.Writer = l.Stdout()
|
||||||
ctl.ErrWriter = l.Stderr()
|
ctl.ErrWriter = l.Stderr()
|
||||||
ctl.Version = config.Version
|
ctl.Version = config.Version
|
||||||
ctl.Usage = "Official VM CLI for Neo-Go"
|
ctl.Usage = "Official VM CLI for NeoGo"
|
||||||
|
|
||||||
// Override default error handler in order not to exit on error.
|
// Override default error handler in order not to exit on error.
|
||||||
ctl.ExitErrHandler = func(context *cli.Context, err error) {}
|
ctl.ExitErrHandler = func(context *cli.Context, err error) {}
|
||||||
|
|
|
@ -35,7 +35,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// newWalletV2FromFile reads a NEO2 wallet from the file.
|
// newWalletV2FromFile reads a Neo Legacy wallet from the file.
|
||||||
// This should be used read-only, no operations are supported on the returned wallet.
|
// This should be used read-only, no operations are supported on the returned wallet.
|
||||||
func newWalletV2FromFile(path string, configPath string) (*walletV2, *string, error) {
|
func newWalletV2FromFile(path string, configPath string) (*walletV2, *string, error) {
|
||||||
if len(path) != 0 && len(configPath) != 0 {
|
if len(path) != 0 && len(configPath) != 0 {
|
||||||
|
@ -127,7 +127,7 @@ func getNumOfThingsFromInstr(script []byte) (int, int, bool) {
|
||||||
|
|
||||||
const minMultisigLen = 37
|
const minMultisigLen = 37
|
||||||
|
|
||||||
// parseMultisigContract accepts a multisig verification script from NEO2
|
// parseMultisigContract accepts a multisig verification script from Neo2
|
||||||
// and returns a list of public keys in the same order as in the script.
|
// and returns a list of public keys in the same order as in the script.
|
||||||
func parseMultisigContract(script []byte) (int, keys.PublicKeys, bool) {
|
func parseMultisigContract(script []byte) (int, keys.PublicKeys, bool) {
|
||||||
// It should contain at least 1 public key.
|
// It should contain at least 1 public key.
|
||||||
|
|
|
@ -107,7 +107,7 @@ func NewCommands() []cli.Command {
|
||||||
signFlags = append(signFlags, options.RPC...)
|
signFlags = append(signFlags, options.RPC...)
|
||||||
return []cli.Command{{
|
return []cli.Command{{
|
||||||
Name: "wallet",
|
Name: "wallet",
|
||||||
Usage: "create, open and manage a NEO wallet",
|
Usage: "create, open and manage a Neo wallet",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
||||||
{
|
{
|
||||||
Name: "claim",
|
Name: "claim",
|
||||||
|
@ -145,7 +145,7 @@ func NewCommands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "convert",
|
Name: "convert",
|
||||||
Usage: "convert addresses from existing NEO2 NEP6-wallet to NEO3 format",
|
Usage: "convert addresses from existing Neo Legacy NEP6-wallet to Neo N3 format",
|
||||||
UsageText: "neo-go wallet convert -w legacywallet [--wallet-config path] -o n3wallet",
|
UsageText: "neo-go wallet convert -w legacywallet [--wallet-config path] -o n3wallet",
|
||||||
Action: convertWallet,
|
Action: convertWallet,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
@ -169,7 +169,7 @@ func NewCommands() []cli.Command {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "dump",
|
Name: "dump",
|
||||||
Usage: "check and dump an existing NEO wallet",
|
Usage: "check and dump an existing Neo wallet",
|
||||||
UsageText: "neo-go wallet dump -w wallet [--wallet-config path] [-d]",
|
UsageText: "neo-go wallet dump -w wallet [--wallet-config path] [-d]",
|
||||||
Description: `Prints the given wallet (via -w option or via wallet configuration file) in JSON
|
Description: `Prints the given wallet (via -w option or via wallet configuration file) in JSON
|
||||||
format to the standard output. If -d is given, private keys are unencrypted and
|
format to the standard output. If -d is given, private keys are unencrypted and
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# NeoGo smart contract compiler
|
# NeoGo smart contract compiler
|
||||||
|
|
||||||
The neo-go compiler compiles Go programs to a bytecode that the NEO virtual machine can understand.
|
The neo-go compiler compiles Go programs to a bytecode that the Neo virtual machine can understand.
|
||||||
|
|
||||||
## Language compatibility
|
## Language compatibility
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ a dialect of Go rather than a complete port of the language:
|
||||||
it's up to the programmer whether assert can be performed successfully.
|
it's up to the programmer whether assert can be performed successfully.
|
||||||
|
|
||||||
## VM API (interop layer)
|
## VM API (interop layer)
|
||||||
Compiler translates interop function calls into NEO VM syscalls or (for custom
|
Compiler translates interop function calls into Neo VM syscalls or (for custom
|
||||||
functions) into NEO VM instructions. [Refer to
|
functions) into Neo VM instructions. [Refer to
|
||||||
pkg.go.dev](https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/interop)
|
pkg.go.dev](https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/interop)
|
||||||
for full API documentation. In general it provides the same level of
|
for full API documentation. In general it provides the same level of
|
||||||
functionality as Neo .net Framework library.
|
functionality as Neo .net Framework library.
|
||||||
|
|
|
@ -338,7 +338,7 @@ protocol-related settings described in the table below.
|
||||||
| GarbageCollectionPeriod | `uint32` | 10000 | Controls MPT garbage collection interval (in blocks) for configurations with `RemoveUntraceableBlocks` enabled and `KeepOnlyLatestState` disabled. In this mode the node stores a number of MPT trees (corresponding to `MaxTraceableBlocks` and `StateSyncInterval`), but the DB needs to be clean from old entries from time to time. Doing it too often will cause too much processing overhead, doing it too rarely will leave more useless data in the DB. |
|
| GarbageCollectionPeriod | `uint32` | 10000 | Controls MPT garbage collection interval (in blocks) for configurations with `RemoveUntraceableBlocks` enabled and `KeepOnlyLatestState` disabled. In this mode the node stores a number of MPT trees (corresponding to `MaxTraceableBlocks` and `StateSyncInterval`), but the DB needs to be clean from old entries from time to time. Doing it too often will cause too much processing overhead, doing it too rarely will leave more useless data in the DB. |
|
||||||
| Hardforks | `map[string]uint32` | [] | The set of incompatible changes that affect node behaviour starting from the specified height. The default value is an empty set which should be interpreted as "each known hard-fork is applied from the zero blockchain height". The list of valid hard-fork names:<br>• `Aspidochelone` represents hard-fork introduced in [#2469](https://github.com/nspcc-dev/neo-go/pull/2469) (ported from the [reference](https://github.com/neo-project/neo/pull/2712)). It adjusts the prices of `System.Contract.CreateStandardAccount` and `System.Contract.CreateMultisigAccount` interops so that the resulting prices are in accordance with `sha256` method of native `CryptoLib` contract. `Aspidochelone` is also includes [#2519](https://github.com/nspcc-dev/neo-go/pull/2519) (ported from the [reference](https://github.com/neo-project/neo/pull/2749)). It adjusts the price of `System.Runtime.GetRandom` interop and fixes its vulnerability. |
|
| Hardforks | `map[string]uint32` | [] | The set of incompatible changes that affect node behaviour starting from the specified height. The default value is an empty set which should be interpreted as "each known hard-fork is applied from the zero blockchain height". The list of valid hard-fork names:<br>• `Aspidochelone` represents hard-fork introduced in [#2469](https://github.com/nspcc-dev/neo-go/pull/2469) (ported from the [reference](https://github.com/neo-project/neo/pull/2712)). It adjusts the prices of `System.Contract.CreateStandardAccount` and `System.Contract.CreateMultisigAccount` interops so that the resulting prices are in accordance with `sha256` method of native `CryptoLib` contract. `Aspidochelone` is also includes [#2519](https://github.com/nspcc-dev/neo-go/pull/2519) (ported from the [reference](https://github.com/neo-project/neo/pull/2749)). It adjusts the price of `System.Runtime.GetRandom` interop and fixes its vulnerability. |
|
||||||
| KeepOnlyLatestState | `bool` | `false` | Specifies if MPT should only store the latest state (or a set of latest states, see `P2PStateExcangeExtensions` section for details). If true, DB size will be smaller, but older roots won't be accessible. This value should remain the same for the same database. | |
|
| KeepOnlyLatestState | `bool` | `false` | Specifies if MPT should only store the latest state (or a set of latest states, see `P2PStateExcangeExtensions` section for details). If true, DB size will be smaller, but older roots won't be accessible. This value should remain the same for the same database. | |
|
||||||
| Magic | `uint32` | `0` | Magic number which uniquely identifies NEO network. |
|
| Magic | `uint32` | `0` | Magic number which uniquely identifies Neo network. |
|
||||||
| MaxBlockSize | `uint32` | `262144` | Maximum block size in bytes. |
|
| MaxBlockSize | `uint32` | `262144` | Maximum block size in bytes. |
|
||||||
| MaxBlockSystemFee | `int64` | `900000000000` | Maximum overall transactions system fee per block. |
|
| MaxBlockSystemFee | `int64` | `900000000000` | Maximum overall transactions system fee per block. |
|
||||||
| MaxTraceableBlocks | `uint32` | `2102400` | Length of the chain accessible to smart contracts. | `RemoveUntraceableBlocks` should be enabled to use this setting. |
|
| MaxTraceableBlocks | `uint32` | `2102400` | Length of the chain accessible to smart contracts. | `RemoveUntraceableBlocks` should be enabled to use this setting. |
|
||||||
|
|
|
@ -289,4 +289,4 @@ the client as JSON-RPC notifications. More details on that are written in the
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
* [JSON-RPC 2.0 Specification](http://www.jsonrpc.org/specification)
|
* [JSON-RPC 2.0 Specification](http://www.jsonrpc.org/specification)
|
||||||
* [NEO JSON-RPC 2.0 docs](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html)
|
* [Neo JSON-RPC 2.0 docs](https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# NEO-GO smart contract examples
|
# NeoGo smart contract examples
|
||||||
|
|
||||||
`examples` directory contains smart contract examples written in Go.
|
`examples` directory contains smart contract examples written in Go.
|
||||||
These examples are aimed to demonstrate the basic usage of Go programming
|
These examples are aimed to demonstrate the basic usage of Go programming
|
||||||
language to write NEO smart contracts as far as to provide a brief introduction
|
language to write Neo smart contracts as far as to provide a brief introduction
|
||||||
to the NEO-specific interop package application.
|
to the Neo-specific interop package application.
|
||||||
|
|
||||||
## Examples structure
|
## Examples structure
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ See the table below for the detailed examples description.
|
||||||
|
|
||||||
| Example | Description |
|
| Example | Description |
|
||||||
|--------------------------| --- |
|
|--------------------------| --- |
|
||||||
| [engine](engine) | This contract demonstrates how to use `runtime` interop package which implements an API for `System.Runtime.*` NEO system calls. Please, refer to the `runtime` [package documentation](../pkg/interop/doc.go) for details. |
|
| [engine](engine) | This contract demonstrates how to use `runtime` interop package which implements an API for `System.Runtime.*` Neo system calls. Please, refer to the `runtime` [package documentation](../pkg/interop/doc.go) for details. |
|
||||||
| [events](events) | The contract shows how execution notifications with the different arguments types can be sent with the help of `runtime.Notify` function of the `runtime` interop package. Please, refer to the `runtime.Notify` [function documentation](../pkg/interop/runtime/runtime.go) for details. |
|
| [events](events) | The contract shows how execution notifications with the different arguments types can be sent with the help of `runtime.Notify` function of the `runtime` interop package. Please, refer to the `runtime.Notify` [function documentation](../pkg/interop/runtime/runtime.go) for details. |
|
||||||
| [iterator](iterator) | This example describes a way to work with NEO iterators. Please, refer to the `iterator` [package documentation](../pkg/interop/iterator/iterator.go) for details. |
|
| [iterator](iterator) | This example describes a way to work with Neo iterators. Please, refer to the `iterator` [package documentation](../pkg/interop/iterator/iterator.go) for details. |
|
||||||
| [nft-d](nft-d) | NEP-11 divisible NFT. See NEP-11 token standard [specification](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki) for details. |
|
| [nft-d](nft-d) | NEP-11 divisible NFT. See NEP-11 token standard [specification](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki) for details. |
|
||||||
| [nft-nd](nft-nd) | NEP-11 non-divisible NFT. See NEP-11 token standard [specification](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki) for details. |
|
| [nft-nd](nft-nd) | NEP-11 non-divisible NFT. See NEP-11 token standard [specification](https://github.com/neo-project/proposals/blob/master/nep-11.mediawiki) for details. |
|
||||||
| [nft-nd-nns](nft-nd-nns) | Neo Name Service contract which is NEP-11 non-divisible NFT. The contract implements methods for Neo domain name system managing such as domains registration/transferring, records addition and names resolving. The package also contains tests implemented with [neotest](https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/neotest). |
|
| [nft-nd-nns](nft-nd-nns) | Neo Name Service contract which is NEP-11 non-divisible NFT. The contract implements methods for Neo domain name system managing such as domains registration/transferring, records addition and names resolving. The package also contains tests implemented with [neotest](https://pkg.go.dev/github.com/nspcc-dev/neo-go/pkg/neotest). |
|
||||||
|
@ -53,7 +53,7 @@ To deploy smart contracts, refer to the
|
||||||
|
|
||||||
Feel free to explore neo-go smart contract development
|
Feel free to explore neo-go smart contract development
|
||||||
[workshop](https://github.com/nspcc-dev/neo-go-sc-wrkshp) to get the basic
|
[workshop](https://github.com/nspcc-dev/neo-go-sc-wrkshp) to get the basic
|
||||||
concepts of how to develop, compile, debug and deploy NEO smart contracts written
|
concepts of how to develop, compile, debug and deploy Neo smart contracts written
|
||||||
in go.
|
in go.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (t Token) CanTransfer(ctx storage.Context, from []byte, to []byte, amount i
|
||||||
return amountFrom
|
return amountFrom
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsUsableAddress checks if the sender is either the correct NEO address or SC address
|
// IsUsableAddress checks if the sender is either the correct Neo address or SC address
|
||||||
func IsUsableAddress(addr []byte) bool {
|
func IsUsableAddress(addr []byte) bool {
|
||||||
if len(addr) == 20 {
|
if len(addr) == 20 {
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ func getBuildInfo(name string, src interface{}) (*buildInfo, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile compiles a Go program into a bytecode that can run on the NEO virtual machine.
|
// Compile compiles a Go program into a bytecode that can run on the Neo virtual machine.
|
||||||
// If `r != nil`, `name` is interpreted as a filename, and `r` as file contents.
|
// If `r != nil`, `name` is interpreted as a filename, and `r` as file contents.
|
||||||
// Otherwise `name` is either a file name or a name of the directory containing source files.
|
// Otherwise `name` is either a file name or a name of the directory containing source files.
|
||||||
func Compile(name string, r io.Reader) ([]byte, error) {
|
func Compile(name string, r io.Reader) ([]byte, error) {
|
||||||
|
|
|
@ -3,11 +3,11 @@ package netmode
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// MainNet contains magic code used in the NEO main official network.
|
// MainNet contains magic code used in the Neo main official network.
|
||||||
MainNet Magic = 0x334f454e // NEO3
|
MainNet Magic = 0x334f454e // NEO3
|
||||||
// TestNet contains magic code used in the NEO testing network.
|
// TestNet contains magic code used in the Neo testing network.
|
||||||
TestNet Magic = 0x3554334e // N3T5
|
TestNet Magic = 0x3554334e // N3T5
|
||||||
// PrivNet contains magic code usually used for NEO private networks.
|
// PrivNet contains magic code usually used for Neo private networks.
|
||||||
PrivNet Magic = 56753 // docker privnet
|
PrivNet Magic = 56753 // docker privnet
|
||||||
// UnitTestNet is a stub magic code used for testing purposes.
|
// UnitTestNet is a stub magic code used for testing purposes.
|
||||||
UnitTestNet Magic = 42
|
UnitTestNet Magic = 42
|
||||||
|
|
|
@ -34,7 +34,7 @@ import (
|
||||||
// from C# implementation https://github.com/neo-project/neo/blob/master/neo/Ledger/Blockchain.cs#L64
|
// from C# implementation https://github.com/neo-project/neo/blob/master/neo/Ledger/Blockchain.cs#L64
|
||||||
const cacheMaxCapacity = 100
|
const cacheMaxCapacity = 100
|
||||||
|
|
||||||
// defaultTimePerBlock is a period between blocks which is used in NEO.
|
// defaultTimePerBlock is a period between blocks which is used in Neo.
|
||||||
const defaultTimePerBlock = 15 * time.Second
|
const defaultTimePerBlock = 15 * time.Second
|
||||||
|
|
||||||
// Number of nanoseconds in millisecond.
|
// Number of nanoseconds in millisecond.
|
||||||
|
|
|
@ -152,7 +152,7 @@ func GetTime(ic *interop.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// BurnGas burns GAS to benefit NEO ecosystem.
|
// BurnGas burns GAS to benefit Neo ecosystem.
|
||||||
func BurnGas(ic *interop.Context) error {
|
func BurnGas(ic *interop.Context) error {
|
||||||
gas := ic.VM.Estack().Pop().BigInt()
|
gas := ic.VM.Estack().Pop().BigInt()
|
||||||
if !gas.IsInt64() {
|
if !gas.IsInt64() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Contract holds information about a smart contract in the NEO blockchain.
|
// Contract holds information about a smart contract in the Neo blockchain.
|
||||||
type Contract struct {
|
type Contract struct {
|
||||||
ContractBase
|
ContractBase
|
||||||
UpdateCounter uint16 `json:"updatecounter"`
|
UpdateCounter uint16 `json:"updatecounter"`
|
||||||
|
|
|
@ -32,7 +32,7 @@ const (
|
||||||
// ErrInvalidWitnessNum returns when the number of witnesses does not match signers.
|
// ErrInvalidWitnessNum returns when the number of witnesses does not match signers.
|
||||||
var ErrInvalidWitnessNum = errors.New("number of signers doesn't match witnesses")
|
var ErrInvalidWitnessNum = errors.New("number of signers doesn't match witnesses")
|
||||||
|
|
||||||
// Transaction is a process recorded in the NEO blockchain.
|
// Transaction is a process recorded in the Neo blockchain.
|
||||||
type Transaction struct {
|
type Transaction struct {
|
||||||
// The trading version which is currently 0.
|
// The trading version which is currently 0.
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/nspcc-dev/rfc6979"
|
"github.com/nspcc-dev/rfc6979"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PrivateKey represents a NEO private key and provides a high level API around
|
// PrivateKey represents a Neo private key and provides a high level API around
|
||||||
// ecdsa.PrivateKey.
|
// ecdsa.PrivateKey.
|
||||||
type PrivateKey struct {
|
type PrivateKey struct {
|
||||||
ecdsa.PrivateKey
|
ecdsa.PrivateKey
|
||||||
|
|
|
@ -35,7 +35,7 @@ func getVarIntSize(value int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating
|
// GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating
|
||||||
// them with variable-length encoding that is used in NEO), strings, pointers to Serializable structures,
|
// them with variable-length encoding that is used in Neo), strings, pointers to Serializable structures,
|
||||||
// slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize<T>(this T[] value)
|
// slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize<T>(this T[] value)
|
||||||
// used in C#, but differs in that it also supports things like Uint160 or Uint256.
|
// used in C#, but differs in that it also supports things like Uint160 or Uint256.
|
||||||
func GetVarSize(value interface{}) int {
|
func GetVarSize(value interface{}) int {
|
||||||
|
|
|
@ -34,8 +34,8 @@ type (
|
||||||
|
|
||||||
// The network mode the server will operate on.
|
// The network mode the server will operate on.
|
||||||
// ModePrivNet docker private network.
|
// ModePrivNet docker private network.
|
||||||
// ModeTestNet NEO test network.
|
// ModeTestNet Neo test network.
|
||||||
// ModeMainNet NEO main network.
|
// ModeMainNet Neo main network.
|
||||||
Net netmode.Magic
|
Net netmode.Magic
|
||||||
|
|
||||||
// Relay determines whether the server is forwarding its inventory.
|
// Relay determines whether the server is forwarding its inventory.
|
||||||
|
|
|
@ -2312,7 +2312,7 @@ func (s *Server) terminateSession(reqParams params.Params) (interface{}, *neorpc
|
||||||
return ok, nil
|
return ok, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// submitBlock broadcasts a raw block over the NEO network.
|
// submitBlock broadcasts a raw block over the Neo network.
|
||||||
func (s *Server) submitBlock(reqParams params.Params) (interface{}, *neorpc.Error) {
|
func (s *Server) submitBlock(reqParams params.Params) (interface{}, *neorpc.Error) {
|
||||||
blockBytes, err := reqParams.Value(0).GetBytesBase64()
|
blockBytes, err := reqParams.Value(0).GetBytesBase64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2338,7 +2338,7 @@ func (s *Server) submitBlock(reqParams params.Params) (interface{}, *neorpc.Erro
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// submitNotaryRequest broadcasts P2PNotaryRequest over the NEO network.
|
// submitNotaryRequest broadcasts P2PNotaryRequest over the Neo network.
|
||||||
func (s *Server) submitNotaryRequest(ps params.Params) (interface{}, *neorpc.Error) {
|
func (s *Server) submitNotaryRequest(ps params.Params) (interface{}, *neorpc.Error) {
|
||||||
if !s.chain.P2PSigExtensionsEnabled() {
|
if !s.chain.P2PSigExtensionsEnabled() {
|
||||||
return nil, neorpc.NewRPCError("P2PSignatureExtensions are disabled", "")
|
return nil, neorpc.NewRPCError("P2PSignatureExtensions are disabled", "")
|
||||||
|
@ -2796,7 +2796,7 @@ func (s *Server) writeHTTPServerResponse(r *params.Request, w http.ResponseWrite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateAddress verifies that the address is a correct NEO address
|
// validateAddress verifies that the address is a correct Neo address
|
||||||
// see https://docs.neo.org/en-us/node/cli/2.9.4/api/validateaddress.html
|
// see https://docs.neo.org/en-us/node/cli/2.9.4/api/validateaddress.html
|
||||||
func validateAddress(addr interface{}) bool {
|
func validateAddress(addr interface{}) bool {
|
||||||
if addr, ok := addr.(string); ok {
|
if addr, ok := addr.(string); ok {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package opcode
|
||||||
|
|
||||||
//go:generate stringer -type=Opcode -linecomment
|
//go:generate stringer -type=Opcode -linecomment
|
||||||
|
|
||||||
// Opcode represents a single operation code for the NEO virtual machine.
|
// Opcode represents a single operation code for the Neo virtual machine.
|
||||||
type Opcode byte
|
type Opcode byte
|
||||||
|
|
||||||
// Viable list of supported instruction constants.
|
// Viable list of supported instruction constants.
|
||||||
|
|
|
@ -1351,7 +1351,7 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
||||||
v.refs.Remove(toRemove)
|
v.refs.Remove(toRemove)
|
||||||
case *stackitem.Map:
|
case *stackitem.Map:
|
||||||
index := t.Index(key.Item())
|
index := t.Index(key.Item())
|
||||||
// NEO 2.0 doesn't error on missing key.
|
// No error on missing key.
|
||||||
if index >= 0 {
|
if index >= 0 {
|
||||||
elems := t.Value().([]stackitem.MapElement)
|
elems := t.Value().([]stackitem.MapElement)
|
||||||
key := elems[index].Key
|
key := elems[index].Key
|
||||||
|
|
Loading…
Reference in a new issue