Port of addrindex

Port of addrindex commit https://github.com/jmcorgan/bitcoin/commit/4790f3c823a33fae44b82ef7962372e38b1b0131