internal void SaveToStream(BinaryWriter bw, bool saveHash = true, bool proto1 = false) { bw.Write(BlockNumber); if (!proto1) { AccountKey.SaveToStream(bw.BaseStream, false); bw.Write(Reward); bw.Write(Fee); bw.Write(ProtocolVersion); bw.Write(AvailableProtocol); bw.Write(Timestamp); bw.Write(CompactTarget); bw.Write(Nonce); Payload.SaveToStream(bw); CheckPointHash.SaveToStream(bw); TransactionHash.SaveToStream(bw); ProofOfWork.SaveToStream(bw); } for (int i = 0; i < 5; i++) { Accounts[i].SaveToStream(bw, saveHash, !proto1); } if (proto1) { bw.Write(Timestamp); } if (saveHash) { BlockHash.SaveToStream(bw); } if (!proto1) { bw.Write(AccumulatedWork); } }