public void Render() { if (Value != null) { return; } var parentKey = new byte[] { }; if (Parent != null) { Parent.Render(); parentKey = Parent.Value.Key; } uint version = 1; string date = "2000-02-02"; var blockHeader = new Types.BlockHeader( version, parentKey, 0, new byte[] { }, new byte[] { }, new byte[] { }, ListModule.OfSeq <byte[]>(new List <byte[]>()), DateTime.Parse(date).ToBinary(), 1, new byte[] { } ); //_TestTransactionPool.Render(); //var block = new Types.Block(blockHeader, ListModule.OfSeq<Types.Transaction>(_TestTransactionPool.Values.Select(t => t.Value.Value))); var block = new Types.Block(blockHeader, ListModule.OfSeq <Types.Transaction>(_Transactions)); // byte[] key = Merkle.blockHasher.Invoke(block); byte[] key = Merkle.blockHeaderHasher.Invoke(block.header); Value = new Keyed <Types.Block>(key, block); TestTrace.Transaction(Tag, key); }
public void Render() { if (Value != null) { return; } var outputs = new List <Types.Output>(); for (var i = 0; i < Outputs; i++) { outputs.Add(Util.GetOutput()); } var inputs = new List <Types.Outpoint>(); foreach (Point point in Inputs) { point.RefTransaction.Render(); inputs.Add(new Types.Outpoint(point.RefTransaction.Value.Key, point.Index)); } var hashes = new List <byte[]>(); //hack Concensus into giving a different hash per each tx created var version = (uint)1; //_Random.Next(1000); Types.Transaction transaction = new Types.Transaction(version, ListModule.OfSeq(inputs), ListModule.OfSeq(hashes), ListModule.OfSeq(outputs), null); byte[] key = Merkle.transactionHasher.Invoke(transaction); Value = new Keyed <Types.Transaction>(key, transaction); TestTrace.Transaction(Tag, key); }