internal RawBlock ToRawBlock( bool includeHash, bool includeTransactionData ) { IEnumerable transactions = Transactions.Select( tx => includeTransactionData ? tx.ToRawTransaction(true) as object : tx.Id.ToByteArray() as object ); var rawBlock = new RawBlock( index: Index, timestamp: Timestamp.ToString(TimestampFormat), nonce: Nonce.ToByteArray(), miner: Miner?.ToByteArray(), difficulty: Difficulty, transactions: transactions, previousHash: PreviousHash?.ToByteArray() ); if (includeHash) { rawBlock = rawBlock.AddHash(Hash.ToByteArray()); } return(rawBlock); }
internal RawBlock ToRawBlock( bool includeHash, bool includeTransactionData ) { IEnumerable <byte[]> transactions = Transactions.OrderBy(tx => tx.Id).Select( tx => includeTransactionData ? tx.Serialize(true) : tx.Id.ToByteArray() ); var rawBlock = new RawBlock( index: Index, timestamp: Timestamp.ToString(TimestampFormat, CultureInfo.InvariantCulture), nonce: Nonce.ToByteArray(), miner: Miner?.ToByteArray(), difficulty: Difficulty, transactions: transactions, previousHash: PreviousHash?.ToByteArray() ); if (includeHash) { rawBlock = rawBlock.AddHash(Hash.ToByteArray()); } return(rawBlock); }