When serving historic blocks, there is no need to calculate the hash of each transaction, so just skip it.
This is mostly refactoring with the following changes:
- Introduce a
CPureTransaction, a stripped down version ofCTransaction(nohashorGetHash()members). Then deriveclass CTransactionfromCPureTransaction - Deduce a
CPureBlockwhich referencesCPureTransactionsin itsvtx.
Deserialization now only takes 14% of the wall clock time it took previously on my machine. You can check locally with:
0./bench_bitcoin --filter=DeserializeBlockTest && ./bench_bitcoin --filter=DeserializePureBlockTest
Sending a single historic block now takes slightly less (90% of the wall clock time it took previously) on a local network. I presume the speedup is more pronounced when sending more than one block.