storage: check for existing blocks only in mainchain

this solves a reorg issue when the node thinks the current chain head is a side branch

https://github.com/lian/bitcoin-ruby/issues/78
OP_CHECKMULTISIGVERIFY

Apparently this has been missing all the time, was just triggered by testnet tx
b5cd9e999fb51e29ab741b1e1732f1d4d038bc493ffbced85a252533a2c2ab0c

Seems easy enough to implement, but the script execution still fails, because the OP_CHECKMULTISIG leaves the stack as [2, 1].
Merge remote-tracking branch 'origin/fix_stuck_blockchain'
always pop extra item from stack to fix OP_CHECKMULTISIG handling
Merge branch 'op_checkmultisigverify'
fix OP_CHECKMULTISIG when OP_0 is used as a pubkey