<div dir="ltr">Why do you want to optimise this? getheaders is used by SPV clients not full nodes. SPV clients like bitcoinj can and do simply ship with gist files in them, then getheaders from the last &quot;checkpoint&quot;   (I wish I hadn&#39;t reused terminology like that but this is what bitcoinj calls them).<div>
<br></div><div>In practice when I look at performance issues with current SPV clients, getheaders speed is not on my radar.</div></div>