From 98adfb4047a127c2d8106cb096c5c8ae14ea80a4 Mon Sep 17 00:00:00 2001 From: Jinghui Liao Date: Thu, 9 Nov 2023 15:05:13 +0800 Subject: [PATCH 1/3] check null scriptcontainer --- src/Neo/SmartContract/ApplicationEngine.Runtime.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs index 41cc6e8c9d..197919f99d 100644 --- a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs +++ b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs @@ -249,6 +249,8 @@ protected internal bool CheckWitnessInternal(UInt160 hash) { if (hash.Equals(CallingScriptHash)) return true; + if (ScriptContainer is null) return false; + if (ScriptContainer is Transaction tx) { Signer[] signers; From f68ca5490766db9b8335a65777ee7cd4b45ac9a8 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 9 Nov 2023 01:19:00 -0800 Subject: [PATCH 2/3] Clean code --- src/Neo/SmartContract/ApplicationEngine.Runtime.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs index 197919f99d..284507749d 100644 --- a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs +++ b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs @@ -249,8 +249,6 @@ protected internal bool CheckWitnessInternal(UInt160 hash) { if (hash.Equals(CallingScriptHash)) return true; - if (ScriptContainer is null) return false; - if (ScriptContainer is Transaction tx) { Signer[] signers; @@ -273,6 +271,10 @@ protected internal bool CheckWitnessInternal(UInt160 hash) } return false; } + else + { + if (ScriptContainer is null) return false; + } // Check allow state callflag From 40ed6eeffc7c4c6816442158c6ac9f0d08df0ac2 Mon Sep 17 00:00:00 2001 From: Shargon Date: Thu, 9 Nov 2023 01:51:22 -0800 Subject: [PATCH 3/3] Add comment --- src/Neo/SmartContract/ApplicationEngine.Runtime.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs index 284507749d..533aefaac0 100644 --- a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs +++ b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs @@ -273,6 +273,7 @@ protected internal bool CheckWitnessInternal(UInt160 hash) } else { + // If we don't have the ScriptContainer, we consider that there are no script hashes for verifying if (ScriptContainer is null) return false; }