Port https://github.com/neo-project/neo/pull/3172. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>