Emergency Hard Fork

by Brown, Sunday, June 14, 2020, 17:05 (539 days ago) @ Brown

Here are the changes I made to net.ml to avoid the peers file from having duplicates:

Line 242 replace:

(incr kcnt; Hashtbl.add knownpeers n lasttm)

with

begin
try
let lasttm2 = Hashtbl.find knownpeers n in
if lasttm > lasttm2 then Hashtbl.replace knownpeers n lasttm
with Not_found ->
incr kcnt; Hashtbl.replace knownpeers n lasttm
end

Replace lines 254-257:

output_string s n;
output_char s '\n';
output_string s (Int64.to_string lasttm);
output_char s '\n')

with

if not (n = "") then
begin
output_string s n;
output_char s '\n';
output_string s (Int64.to_string lasttm);
output_char s '\n'
end)

Replace line 1089:

Hashtbl.add knownpeers n currtm

with

Hashtbl.replace knownpeers n currtm


Complete thread:

 RSS Feed of thread

powered by my little forum