Add a basic CHubListener that can be extended.
Add AskForBlocks/RegisterAskForBlocks functionality to CHub.

Creating a callback to request blocks from peers.
Add EmitBlock/CommitBlock functionality to CHub.

Replacing ProcessBlock with EmitBlock, and creating callbacks for
CommitBlock.
Fix typo
Add HandleCommitBlock to net.cpp & move stuff from main.cpp to it
Remove uiInterface.NotifyBlocksChanged and replace with CommitBlock

Also rename NotifyBlocksChanged to NotifyNewBlock and remove from
the uiInterface signals list.

This removes some functionality, but NofiyBlocksChanged was not
used anyway, so it shouldn't matter.  That said, if it is ever
needed, it would be fairly trivial to add a new callback for it
in CHub.
Add EmitAlert/CommitAlert functionality to CHub.

Replace ProcessAlert with calls to EmitAlert and create callbacks
for CommitAlert.
Use CommitAlert in qt/clientmodel.cpp
Add RegisterRemoveAlert functionality to CHub.
Replace NotifyAlertChanged with RegisterRemoveAlert.
Convert Orphan Tx storage to CTransactions from CDataStreams.

There was no reason to use CDataStream as the transaction was
already being serialized/deserialized several times, with this
change, transactions coming in over network are deserialized once
when received, and then only reserialized in the call to
RelayMessage, which will be called in a callback thread, not
blocking cs_main.
Add a cs around mapAlreadyAskedFor.
Add basic EmitTransaction/CommitTransaction functionality to CHub.
Use EmitTransaction instead of AcceptToMemoryPool in sendrawtx.
Add CWallet support for registering with a CHub.
Use HandleCommitTransactionToMemoryPool instead of SyncWithWallets.
Remove AcceptToMemoryPool and replace with EmitTransaction.

 * This removes not only CTransaction::AcceptToMemoryPool, but
    also CMerkleTx::AcceptToMemoryPool. It also moves
    CWalletTx::AcceptWalletTransaction to wallet.cpp

 * This adds a fCheckInputs flag to EmitTransaction, which is
    similar to the fCheckInputs flag to AcceptToMemoryPool,
    however, it has stricter guidlines that it should only be set
    "when transaction is a supporting tx for one of our own."
    Additionally, "fCheckInputs is ignored (and set to true)
    if !IsInitialBlockDownload() && !fClient"

    As a part of these guidelines,
    CWalletTx::AcceptWalletTransaction calls EmitTransaction with
    fCheckInputs set to true (the default) on the final
    transaction, whereas it used to call with fCheckInputs set to
    false. This has the important side-effect of allowing wallet-
    generated transactions to end up getting AddOrphanTx'd.
    However, if a supporting transaction to one of our own had
    previously been AddOrphanTx'd, it would immediately be added
    to memory pool as it is "a supporting tx for one of our own"
    and thus is re-added with fCheckInputs=false.

    Note that the possibility of a wallet transaction getting
    AddOrphanTx'd is very low, and should only happen if
    a) a transaction's input is a generate and we are missing that
       block (note that no transactions should be generated with a
       generation input if we don't have that block anyway).
    b) We match the !IsInitialBlockDownload() && !fClient check,
       are not caught up to the latest block, and an input is in a
       block we do not yet have (possible after the last
       checkpoint). This situation is temporary and should resolve
       itself once we catch up (though AddOrphanTx'd transactions
       may be permanently orphaned).

    Largely, these guidelines are there because there is no reason
    to add a transaction without checking its inputs, as we have
    those inputs available, and checking them as any other
    transaction would provides additional sanity-checks.

 * A second EmitTransaction was added with tx of type CMerkleTx.
    This keeps behavior of CMerkleTx::AcceptToMemoryPool the same
    in fClient mode. Note that new behavior was invented for
    CHub::EmitTransaction(CTransaction&...) in fClient mode,
    namely that ClientConnectInputs is only checked if
    fCheckInputs is true. This was chosen to make emitting a
    transaction possible in fClient mode even if its inputs are
    not available, but could be changed if support for that is not
    needed when fClient mode is actually implemented.
Add a CBlockStore class to hold the blockstore.
Add support for registering a CBlockStore with CHub.
Move EmitBlock handling from CHub to CBlockStore.