Initial version of coinbase check for cgminer

When do pool mining, users get job from the pool by being pushed stratum mining_notify message or firing GBT message, however if the pool was compromised by some malicious hackers then the job might generate no benefit for users.  By introducing the coinbase checking function in the client, user can ensure that (how much of) the benefits, if any, is going to the expected address, so that greatly reduces the risk of wasting their hashing power.  From another side, a pool that always generates coinbases passing users' check can give its client enough confidence to trust it.

The usage is pretty straightforward, three arguments are added, say --cbaddr, --cbtotal, and -cbperc, all are per-pool settings. --cbaddr specifies the address user want to check against in the coinbase txn, --cbtotal indicates the total amount of benefit the coinbase should include, while --cbperc tells the percentage in all benefit the --cbaddr specified address should obtain.

Here is the typical usage: cgminer -u XX -p YY -o stratum+tcp://thepool.com --cbaddr POOL_ADDR --cbtotal '>2499999999' --cbperc '>0.99';  the command would check whether the total amount output coins in the coinbase txn is more than 2499999999, and the POOL_ADDR would receive more that 99% of that.

Both "--cbtotal" and "--cbperc" arguments need a '>'/'+', '<'/'-', or '=' prefix to tell what kind of comparing the user want to check against the coinbase.  Note when using '>' or '<', quotation marks ’  or " would be needed to avoid confusing the shell with I/O redirection, for convenience '+' or '-' can be used instead, e.g. the above sample can be rewritten like: cgminer -u XX -p YY -o stratum+tcp://thepool.com --cbaddr POOL_ADDR --cbtotal +2499999999 --cbperc +0.99.

Besides that "--cbperc" obviously depends on "--cbaddr", the three new args can be combined without any other restriction.

Note that patches including the same function had also be submitted to cpuminer and bfgminer.

Signed-off-by: Huang Le <4tarhl@gmail.com>