gossip: add COMPLETED bit to mark records which are complete.
This should detect partial writes more robustly, since we make a separate pwrite() call to update this flag after the record is written. Previously we were playing a bit loose with synchronization assumptions, which seemed to work on Linux ext4, but not so well elsewhere. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -47,7 +47,8 @@ static void write_outmsg(int outfd, const u8 *outmsg, u32 timestamp)
|
||||
{
|
||||
struct gossip_hdr hdr;
|
||||
|
||||
hdr.len = cpu_to_be32(tal_count(outmsg));
|
||||
hdr.flags = CPU_TO_BE16(GOSSIP_STORE_COMPLETED_BIT);
|
||||
hdr.len = cpu_to_be16(tal_count(outmsg));
|
||||
hdr.crc = cpu_to_be32(crc32c(timestamp, outmsg, tal_count(outmsg)));
|
||||
hdr.timestamp = cpu_to_be32(timestamp);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/* Current versions we support */
|
||||
#define GSTORE_MAJOR 0
|
||||
#define GSTORE_MINOR 14
|
||||
#define GSTORE_MINOR 15
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user