shachain: add shachain_next_index()