mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
core: remove Block.GetTransaction interops
Removed Neo.Block.GetTransaction and System.Block.GetTransaction interops. These interops were replaced by new System.Blockchain.GetTransactionFromBlock interop.
This commit is contained in:
parent
d692de5ea4
commit
e2187c0a96
5 changed files with 0 additions and 27 deletions
|
@ -58,7 +58,6 @@ var syscalls = map[string]map[string]string{
|
|||
"block": {
|
||||
"GetTransactionCount": "Neo.Block.GetTransactionCount",
|
||||
"GetTransactions": "Neo.Block.GetTransactions",
|
||||
"GetTransaction": "Neo.Block.GetTransaction",
|
||||
},
|
||||
"contract": {
|
||||
"GetScript": "Neo.Contract.GetScript",
|
||||
|
|
|
@ -265,23 +265,6 @@ func blockGetTransactions(ic *interop.Context, v *vm.VM) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// blockGetTransaction returns transaction with the given number from the given
|
||||
// block.
|
||||
func blockGetTransaction(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")
|
||||
}
|
||||
index := v.Estack().Pop().BigInt().Int64()
|
||||
if index < 0 || index >= int64(len(block.Transactions)) {
|
||||
return errors.New("wrong transaction index")
|
||||
}
|
||||
tx := block.Transactions[index]
|
||||
v.Estack().PushVal(stackitem.NewInterop(tx))
|
||||
return nil
|
||||
}
|
||||
|
||||
// engineGetScriptContainer returns transaction that contains the script being
|
||||
// run.
|
||||
func engineGetScriptContainer(ic *interop.Context, v *vm.VM) error {
|
||||
|
|
|
@ -62,7 +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.GetTransaction", Func: blockGetTransaction, Price: 1},
|
||||
{Name: "System.Block.GetTransactionCount", Func: blockGetTransactionCount, Price: 1},
|
||||
{Name: "System.Block.GetTransactions", Func: blockGetTransactions, Price: 1},
|
||||
{Name: "System.Blockchain.GetBlock", Func: bcGetBlock, Price: 200},
|
||||
|
@ -105,7 +104,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.GetTransaction", Func: blockGetTransaction, Price: 1},
|
||||
{Name: "Neo.Block.GetTransactionCount", Func: blockGetTransactionCount, Price: 1},
|
||||
{Name: "Neo.Block.GetTransactions", Func: blockGetTransactions, Price: 1},
|
||||
{Name: "Neo.Blockchain.GetAccount", Func: bcGetAccount, Price: 100},
|
||||
|
|
|
@ -34,7 +34,6 @@ func TestUnexpectedNonInterops(t *testing.T) {
|
|||
funcs := []func(*interop.Context, *vm.VM) error{
|
||||
accountGetBalance,
|
||||
accountGetScriptHash,
|
||||
blockGetTransaction,
|
||||
blockGetTransactionCount,
|
||||
blockGetTransactions,
|
||||
contractGetScript,
|
||||
|
|
|
@ -22,9 +22,3 @@ func GetTransactionCount(b Block) int {
|
|||
func GetTransactions(b Block) []blockchain.Transaction {
|
||||
return []blockchain.Transaction{}
|
||||
}
|
||||
|
||||
// GetTransaction returns transaction from the given block by its index. It
|
||||
// uses `Neo.Block.GetTransaction` syscall internally.
|
||||
func GetTransaction(b Block, index int) blockchain.Transaction {
|
||||
return blockchain.Transaction{}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue