コード例 #1
0
        bool Storage_GetContext(IExecutionEngine engine)
        {
            using (var context = engine.CurrentContext)
            {
                if (context == null)
                {
                    return(false);
                }

                var id = context.ScriptHash.ToHexString();
                if (!Storages.TryGetValue(id, out DummyStorageContext stContext))
                {
                    stContext = new DummyStorageContext(id, context.ScriptHash);
                    Storages[stContext.Id] = stContext;
                }

                using (var i = engine.CreateInterop(stContext))
                    context.EvaluationStack.Push(i);
            }

            return(true);
        }