I am stuck on sending an empty rdb file to the replica. I am able to send a correctly parsed rdb file, but the test runner says
Error: Expected 176 bytes of data in RDB file message, got 116
This is the code theat generates the rdb file:
pub fn str_from_empty() -> String {
let whitespace = &[' ', '\t', '\n', '\r'] as &[_];
let hex_string = "52 45 44 49 53 30 30 31 31 fa 09 72 65 64 69 73
2d 76 65 72 05 37 2e 32 2e 35 fa 0a 72 65 64 69
73 2d 62 69 74 73 c0 40 fa 05 63 74 69 6d 65 c2
c4 56 0a 67 fa 08 75 73 65 64 2d 6d 65 6d c2 70
52 13 00 fa 08 61 6f 66 2d 62 61 73 65 c0 00 ff
8e 5e 7f 5f b5 78 4f ce".replace(whitespace, "");
format!("${}\r\n{}", hex_string.len(), String::from_utf8_lossy(&crate::util::util::hex_to_binary(&hex_string)))
}
pub fn hex_to_binary(hex: &str) -> Vec<u8> {
hex.as_bytes().chunks(2).map(|byte| u8::from_str_radix(std::str::from_utf8(byte).unwrap(), 16).unwrap()).collect()
}
Can anyone tell me why this file is not the correct number of bytes?