forked from TrueCloudLab/neoneo-go
Merge pull request #1551 from nspcc-dev/core/adjust_runtime_notify
core: adjust System.Runtime.Notify interop
This commit is contained in:
commit
4640ba2758
1 changed files with 6 additions and 5 deletions
|
@ -266,12 +266,13 @@ func runtimeNotify(ic *interop.Context) error {
|
||||||
args := elem.Array()
|
args := elem.Array()
|
||||||
// But it has to be serializable, otherwise we either have some broken
|
// But it has to be serializable, otherwise we either have some broken
|
||||||
// (recursive) structure inside or an interop item that can't be used
|
// (recursive) structure inside or an interop item that can't be used
|
||||||
// outside of the interop subsystem anyway. I'd probably fail transactions
|
// outside of the interop subsystem anyway.
|
||||||
// that emit such broken notifications, but that might break compatibility
|
bytes, err := stackitem.SerializeItem(elem.Item())
|
||||||
// with testnet/mainnet, so we're replacing these with error messages.
|
|
||||||
_, err := stackitem.SerializeItem(elem.Item())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
args = []stackitem.Item{stackitem.NewByteArray([]byte(fmt.Sprintf("bad notification: %v", err)))}
|
return fmt.Errorf("bad notification: %w", err)
|
||||||
|
}
|
||||||
|
if len(bytes) > MaxNotificationSize {
|
||||||
|
return fmt.Errorf("notification size shouldn't exceed %d", MaxNotificationSize)
|
||||||
}
|
}
|
||||||
ne := state.NotificationEvent{
|
ne := state.NotificationEvent{
|
||||||
ScriptHash: ic.VM.GetCurrentScriptHash(),
|
ScriptHash: ic.VM.GetCurrentScriptHash(),
|
||||||
|
|
Loading…
Reference in a new issue