diff --git a/neo/Network/P2P/Payloads/Transaction.cs b/neo/Network/P2P/Payloads/Transaction.cs index d84cb909f6..123fc3ba6e 100644 --- a/neo/Network/P2P/Payloads/Transaction.cs +++ b/neo/Network/P2P/Payloads/Transaction.cs @@ -82,26 +82,24 @@ public virtual Fixed8 NetworkFee } private IReadOnlyDictionary _references; - private bool hasCalculatedReferences = false; public IReadOnlyDictionary References { get { - if (!hasCalculatedReferences && _references == null) + if (_references == null) { - hasCalculatedReferences = true; Dictionary dictionary = new Dictionary(); foreach (var group in Inputs.GroupBy(p => p.PrevHash)) { Transaction tx = Blockchain.Singleton.Store.GetTransaction(group.Key); if (tx == null) return null; - foreach (var reference in group) + foreach (var reference in group.Select(p => new { - if (reference.PrevIndex >= Outputs.Length) - { - return null; - } - dictionary.Add(reference, tx.Outputs[reference.PrevIndex]); + Input = p, + Output = tx.Outputs[p.PrevIndex] + })) + { + dictionary.Add(reference.Input, reference.Output); } } _references = dictionary;