core: adjust System.Blockchain.GetTransactionFromBlock interop

To match C# implementation, we should pick all arguments from stack first.
This commit is contained in:
Anna Shaleva 2020-07-15 13:05:29 +03:00
parent a1f98f92fe
commit 74ffde8367

View file

@ -155,12 +155,12 @@ func bcGetTransactionFromBlock(ic *interop.Context, v *vm.VM) error {
if err != nil { if err != nil {
return err return err
} }
index := v.Estack().Pop().BigInt().Int64()
block, err := ic.DAO.GetBlock(hash) block, err := ic.DAO.GetBlock(hash)
if err != nil || !isTraceableBlock(ic, block.Index) { if err != nil || !isTraceableBlock(ic, block.Index) {
v.Estack().PushVal(stackitem.Null{}) v.Estack().PushVal(stackitem.Null{})
return nil return nil
} }
index := v.Estack().Pop().BigInt().Int64()
if index < 0 || index >= int64(len(block.Transactions)) { if index < 0 || index >= int64(len(block.Transactions)) {
return errors.New("wrong transaction index") return errors.New("wrong transaction index")
} }