Add tx hash for "Deposit" and "Withdraw" notifications

As the user can invoke several deposit or withdraw calls
inner ring nodes should be able to differ them even if they
have the same arguments. To do that neofs-contract notifies
about tx hash, which can be used as unique identifier of
withdraw or deposit operation.
This commit is contained in:
alexvanin 2020-05-29 11:44:15 +03:00
parent 2f3cfee6ae
commit 19db32b654

View file

@ -5,6 +5,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/engine" "github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime" "github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage" "github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/transaction"
"github.com/nspcc-dev/neo-go/pkg/interop/util" "github.com/nspcc-dev/neo-go/pkg/interop/util"
) )
@ -152,7 +153,10 @@ func Main(op string, args []interface{}) interface{} {
rcv = args[2].([]byte) // todo: check if rcv value is valid rcv = args[2].([]byte) // todo: check if rcv value is valid
} }
runtime.Notify("Deposit", pk, amount, rcv) tx := engine.GetScriptContainer()
txHash := transaction.GetHash(tx)
runtime.Notify("Deposit", pk, amount, rcv, txHash)
return true return true
case "Withdraw": case "Withdraw":
@ -171,7 +175,10 @@ func Main(op string, args []interface{}) interface{} {
amount = amount * 100000000 amount = amount * 100000000
} }
runtime.Notify("Withdraw", user, amount) tx := engine.GetScriptContainer()
txHash := transaction.GetHash(tx)
runtime.Notify("Withdraw", user, amount, txHash)
return true return true
case "Cheque": case "Cheque":