Changed LevelDB cursors to use scoped pointers to ensure destruction when going out of scope.

This corrects a bug where an exception thrown reading from the database causes the cursor to
be left open, which causes an assertion error to occur when the database is deleted (around
line 938 of init.cpp).

Rebased-from: 5cbda4f10f16923910de2bd080152fc7bbc48738
rpc: Fix leveldb iterator leak, and flush before `gettxoutsetinfo`

This fixes an iterator leak resulting in

    bitcoind: db/version_set.cc:789: leveldb::VersionSet::~VersionSet(): Assertion `dummy_versions_.next_ == &dummy_versions_' failed."

exception on shutdown.

Also make sure to flush pcoinsTip before calling GetStats() to make
sure we apply them to the current height.

Conflicts:
	src/txdb.cpp

Rebased-from: 33dfbf57d34882aef7b83bc5ea9bf561e1f3e7b0
getblockhash: throw JSONRPCError (not runtime_error)

Rebased-from: 6261e6e6e0ae9860d322efe0f11d0960b300dad4
Relax IsStandard rules for pay-to-script-hash transactions

Relax the AreInputsStandard() tests for P2SH transactions --
allow any Script in a P2SH transaction to be relayed/mined,
as long as it has 15 or fewer signature operations.

Rationale: https://gist.github.com/gavinandresen/88be40c141bc67acb247

I don't have an easy way to test this, but the code changes are
straightforward and I've updated the AreInputsStandard unit tests.

Conflicts:
	src/main.h
	src/test/script_P2SH_tests.cpp

Rebased-from: 7f3b4e95695d50a4970e6eb91faa956ab276f161
Upgrade to openssl-1.0.1j
OMG: Update release-process.md to better describe the OMG gitian.sigs procedure