mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
core: remove Block.GetTransactions, Block.GetTransactionsCount interops
Updated System.Blockchain.GetBlock interop replaced the functionality of the following interops: System.Block.GetTransactions System.Block.GetTransactionCount Neo.Block.GetTransactions Neo.Block.GetTransactionsCount
This commit is contained in:
parent
7a2d37cf7e
commit
8b7abd36c9
5 changed files with 0 additions and 63 deletions
|
@ -55,10 +55,6 @@ var syscalls = map[string]map[string]string{
|
|||
"GetConsensusData": "Neo.Header.GetConsensusData",
|
||||
"GetNextConsensus": "Neo.Header.GetNextConsensus",
|
||||
},
|
||||
"block": {
|
||||
"GetTransactionCount": "Neo.Block.GetTransactionCount",
|
||||
"GetTransactions": "Neo.Block.GetTransactions",
|
||||
},
|
||||
"contract": {
|
||||
"GetScript": "Neo.Contract.GetScript",
|
||||
"IsPayable": "Neo.Contract.IsPayable",
|
||||
|
|
|
@ -250,35 +250,6 @@ func headerGetTimestamp(ic *interop.Context, v *vm.VM) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// blockGetTransactionCount returns transactions count in the given block.
|
||||
func blockGetTransactionCount(ic *interop.Context, v *vm.VM) error {
|
||||
blockInterface := v.Estack().Pop().Value()
|
||||
block, ok := blockInterface.(*block.Block)
|
||||
if !ok {
|
||||
return errors.New("value is not a block")
|
||||
}
|
||||
v.Estack().PushVal(len(block.Transactions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// blockGetTransactions returns transactions from the given block.
|
||||
func blockGetTransactions(ic *interop.Context, v *vm.VM) error {
|
||||
blockInterface := v.Estack().Pop().Value()
|
||||
block, ok := blockInterface.(*block.Block)
|
||||
if !ok {
|
||||
return errors.New("value is not a block")
|
||||
}
|
||||
if len(block.Transactions) > vm.MaxArraySize {
|
||||
return errors.New("too many transactions")
|
||||
}
|
||||
txes := make([]stackitem.Item, 0, len(block.Transactions))
|
||||
for _, tx := range block.Transactions {
|
||||
txes = append(txes, stackitem.NewInterop(tx))
|
||||
}
|
||||
v.Estack().PushVal(txes)
|
||||
return nil
|
||||
}
|
||||
|
||||
// engineGetScriptContainer returns transaction that contains the script being
|
||||
// run.
|
||||
func engineGetScriptContainer(ic *interop.Context, v *vm.VM) error {
|
||||
|
|
|
@ -62,8 +62,6 @@ func getInteropFromSlice(ic *interop.Context, slice []interop.Function) func(uin
|
|||
|
||||
// All lists are sorted, keep 'em this way, please.
|
||||
var systemInterops = []interop.Function{
|
||||
{Name: "System.Block.GetTransactionCount", Func: blockGetTransactionCount, Price: 1},
|
||||
{Name: "System.Block.GetTransactions", Func: blockGetTransactions, Price: 1},
|
||||
{Name: "System.Blockchain.GetBlock", Func: bcGetBlock, Price: 250},
|
||||
{Name: "System.Blockchain.GetContract", Func: bcGetContract, Price: 100},
|
||||
{Name: "System.Blockchain.GetHeader", Func: bcGetHeader, Price: 100},
|
||||
|
@ -104,8 +102,6 @@ var neoInterops = []interop.Function{
|
|||
{Name: "Neo.Account.GetBalance", Func: accountGetBalance, Price: 1},
|
||||
{Name: "Neo.Account.GetScriptHash", Func: accountGetScriptHash, Price: 1},
|
||||
{Name: "Neo.Account.IsStandard", Func: accountIsStandard, Price: 100},
|
||||
{Name: "Neo.Block.GetTransactionCount", Func: blockGetTransactionCount, Price: 1},
|
||||
{Name: "Neo.Block.GetTransactions", Func: blockGetTransactions, Price: 1},
|
||||
{Name: "Neo.Blockchain.GetAccount", Func: bcGetAccount, Price: 100},
|
||||
{Name: "Neo.Blockchain.GetContract", Func: bcGetContract, Price: 100},
|
||||
{Name: "Neo.Blockchain.GetHeader", Func: bcGetHeader, Price: 100},
|
||||
|
|
|
@ -34,8 +34,6 @@ func TestUnexpectedNonInterops(t *testing.T) {
|
|||
funcs := []func(*interop.Context, *vm.VM) error{
|
||||
accountGetBalance,
|
||||
accountGetScriptHash,
|
||||
blockGetTransactionCount,
|
||||
blockGetTransactions,
|
||||
contractGetScript,
|
||||
contractGetStorageContext,
|
||||
contractIsPayable,
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
Package block provides getters for Neo Block structure.
|
||||
*/
|
||||
package block
|
||||
|
||||
import "github.com/nspcc-dev/neo-go/pkg/interop/blockchain"
|
||||
|
||||
// Block represents a NEO block, it's an opaque data structure that you can get
|
||||
// data from only using functions from this package. It's similar in function to
|
||||
// the Block class in the Neo .net framework. To use it you need to get it via
|
||||
// blockchain.GetBlock function call.
|
||||
type Block struct{}
|
||||
|
||||
// GetTransactionCount returns the number of recorded transactions in the given
|
||||
// block. It uses `Neo.Block.GetTransactionCount` syscall internally.
|
||||
func GetTransactionCount(b Block) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetTransactions returns a slice of transactions recorded in the given block.
|
||||
// It uses `Neo.Block.GetTransactions` syscall internally.
|
||||
func GetTransactions(b Block) []blockchain.Transaction {
|
||||
return []blockchain.Transaction{}
|
||||
}
|
Loading…
Reference in a new issue