Fixed mempool sync after sending a transaction
Check pindexBestForkBase for null
Make -proxy set all network types, avoiding a connect leak.

Previously -proxy was not setting the proxy for IsLimited networks, so
 if you set your configuration to be onlynet=tor you wouldn't get an
 IPv4 proxy set.

The payment protocol gets its proxy configuration from the IPv4 proxy,
 and so it would experience a connection leak.

This addresses issue #5355 and also clears up a cosmetic bug where
 getinfo proxy output shows nothing when onlynet=tor is set.
Improve chainstate/blockindex disk writing policy

There are 3 pieces of data that are maintained on disk. The actual block
and undo data, the block index (which can refer to positions on disk),
and the chainstate (which refers to the best block hash).

Earlier, there was no guarantee that blocks were written to disk before
block index entries referring to them were written. This commit introduces
dirty flags for block index data, and delays writing entries until the actual
block data is flushed.

With this stricter ordering in writes, it is now safe to not always flush
after every block, so there is no need for the IsInitialBlockDownload()
check there - instead we just write whenever enough time has passed or
the cache size grows too large. Also updating the wallet's best known block
is delayed until this is done, otherwise the wallet may end up referring to an
unknown block.

In addition, only do a write inside the block processing loop if necessary
(because of cache size exceeded). Otherwise, move the writing to a point
after processing is done, after relaying.
Introduce separate flushing modes
[Qt, OSX] fix Qt4.8 compatibility with QProgressBar issue

Rebased-From: 7f33d2cebfde99ded12c711ef6bd77c91725cfb8
Github-Issue: #5344
Merge pull request #5154

730b1ed Check pindexBestForkBase for null (21E14)
Merge pull request #5358

3c77714 Make -proxy set all network types, avoiding a connect leak. (Gregory Maxwell)
Merge pull request #5335

7e615f5 Fixed mempool sync after sending a transaction (Suhas Daftuar)
qt: osx: fix hidden symbol visibility

Fixes default hidden symbol visibility for our linux->osx cross build. Without
this change, the check for working -fvisibility=hidden fails, and all symbols
are visible by default.

Ugly as this is, it's just a simple find/replace to fix a bug in Qt's configure.
They assume in an "XPLATFORM_MAC" block that the builder is capable of running
osx programs. This should be "BUILD_ON_MAC" instead.
Merge pull request #5362

d61dc25 qt: osx: fix hidden symbol visibility (Cory Fields)
Merge pull request #5241

a206950 Introduce separate flushing modes (Pieter Wuille)
51ce901 Improve chainstate/blockindex disk writing policy (Pieter Wuille)
No semantic change: reuse stack variable in P2SH evaluation
Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6)

Based on an earlier patch by Peter Todd, though the rules here are different
(P2SH scripts should not have a CLEANSTACK check before the P2SH evaluation).
Make SCRIPT_VERIFY_CLEANSTACK a standardness requirement