Implement memory chain pruning.

This commit implements pruning for the block nodes that form the memory
chain which are no longer needed.  The validation of a block only requires
information from a set number of previous nodes.  The initial code did not
prune old nodes as they were no longer needed, but the vast majority of
the infrastructure to support it was already in place as that was always
the goal.  This commit finishes implementing the missing bits to make it
a reality.