From d959efcc4974eab11e411b8e614faac44a613dcc Mon Sep 17 00:00:00 2001 From: Yongjie Ma <20391402+yongjiema@users.noreply.github.com> Date: Fri, 16 Aug 2019 19:25:06 +0800 Subject: [PATCH] Fix the potential risk to get null CurrentHeaderHash from Blockchain (#1033) --- neo/Ledger/Blockchain.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/Ledger/Blockchain.cs b/neo/Ledger/Blockchain.cs index 889d4b18bb..7d0b72402d 100644 --- a/neo/Ledger/Blockchain.cs +++ b/neo/Ledger/Blockchain.cs @@ -66,9 +66,9 @@ public class FillCompleted { } public Store Store { get; } public MemoryPool MemPool { get; } public uint Height => currentSnapshot.Height; - public uint HeaderHeight => (uint)header_index.Count - 1; + public uint HeaderHeight => currentSnapshot.HeaderHeight; public UInt256 CurrentBlockHash => currentSnapshot.CurrentBlockHash; - public UInt256 CurrentHeaderHash => header_index[header_index.Count - 1]; + public UInt256 CurrentHeaderHash => currentSnapshot.CurrentHeaderHash; private static Blockchain singleton; public static Blockchain Singleton