Initial version of coinbase checking funciton for stratum pool

In stratum pool mining mode, the pool sends mining_notify message to distribute job, however, to reduce bandwidth usage, there is no transaction list included in the message, the miner would have to ask for it explicitly by sending a get_transactions message if desired, that in effect loses the bandwidth saving of stratum protocol, which actually is the essence.

By adding a coinbase checking function, we can possibly obsolete the necessary of get_transactions message during most circumstance:
    1. We ensure this is a valid BTC coinbase for btc, so reduce the possibility of pool stealing power for other kind of work;
    2. We check amount and to-address by going through the whole payout list, so reduce the possibility of pool stealing the coins mined;
    3. We can even specify the percent regards how much pool can gain from this mining job, so reduce the possibility of pool transferring (part of) coins mined to unknown address;
    4. This also creates possibility for other kind of collaborative mode between pool and miners, which we are actually looking on...

The coinbase checking can not totally replace get_transactions message, but combined with other human actions it can give miners‘ enough confidence to trust a pool.

The usage is pretty straightforward: input --coinbase-perc argument with --coinbase-addr, e.g.: --coinbase-addr='XXXX' --coinbase-perc='=1', or --coinbase-perc='>0.99', or --coinbase-perc='<0.05', etc, the command will check the addr 'XXXX' get corresponding percent of the whole benefit, else it would output an error message.

Signed-off-by: Huang Le <4tarhl@gmail.com>
This code is generic regardless of protocol, so we can move it to a function too.