Fixed a bunch of really subtle issues with SSH handling

I got caught passing ephemeral references to BinaryRefReader
constructors, thus setting the BRR to track an object that goes out of
scope as soon as it's done being constructed.  Whoops!  Also was not
setting SSH.uniqueKey_ on getStoredScriptHistory(SSH) calls.

It really helps to be able to pretty-print the entire DB for this small
reorg blockchain, though much of my most recent debugging has been
fixing the pretty-printing itself, not the code I'm trying to test.  Oh
well.