Use byzantine code, get byzantine behavior.
This should be the last of the fixes hopefully.
Also in this commit: Some simplification in Servers.cpp and some comment
fixups and exception message cleanup.
Oops. :) Truncate was buggy. Fixed.
Also made all the merkle functions throw rather than just print errors
to the log. They do print errors to the log as well for critical
errors.
This is so we can characterize how costly the O(N log N) is. It's not
too bad but would need a threedpool worker to calculate it for larger
sets of txhashes (say >10k?), in order to keep the server from becomming
laggy.
blockchain.transaction.id_from_pos is now fully implemented, as is
blockchain.transaction.get_merkle.
They both use a cache to store the txHashes for a particular block, and
resort to reading from the disk file if not found in cache.
This cache stores the txHashes for 500 of the most recently queried
blocks. In the worst pathological circumstances of 64k tx's per block,
the cache would use about 1.5GB of memory at worst. In practice it will
use much less as blocks are empty.