diff --git a/src/neo/SmartContract/InteropService.Blockchain.cs b/src/neo/SmartContract/InteropService.Blockchain.cs index b31aba4a32..60e6e1906d 100644 --- a/src/neo/SmartContract/InteropService.Blockchain.cs +++ b/src/neo/SmartContract/InteropService.Blockchain.cs @@ -45,8 +45,25 @@ private static bool Blockchain_GetBlock(ApplicationEngine engine) private static bool Blockchain_GetTransaction(ApplicationEngine engine) { - ReadOnlySpan hash = engine.CurrentContext.EvaluationStack.Pop().GetSpan(); - Transaction tx = engine.Snapshot.GetTransaction(new UInt256(hash)); + Transaction tx; + StackItem item = engine.CurrentContext.EvaluationStack.Pop(); + + if (item.IsNull) + { + if (engine.ScriptContainer is Transaction senderTx) + { + tx = senderTx; + } + else + { + return false; + } + } + else + { + tx = engine.Snapshot.GetTransaction(new UInt256(item.GetSpan())); + } + if (tx == null) engine.CurrentContext.EvaluationStack.Push(StackItem.Null); else