X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fcrypto%2Fshachain%2Fshachain.h;fp=ccan%2Fcrypto%2Fshachain%2Fshachain.h;h=8eabbab457a72b49c2c47736ce6e7d19f0b8fe82;hp=90f2380ed39b89d8277db3542e669fcc22f7176e;hb=8ad6ab9ce9b78c6b28b727b11d571d11856479c6;hpb=2a03b7b304b185680ff0255731c671b71a7fb1b2 diff --git a/ccan/crypto/shachain/shachain.h b/ccan/crypto/shachain/shachain.h index 90f2380e..8eabbab4 100644 --- a/ccan/crypto/shachain/shachain.h +++ b/ccan/crypto/shachain/shachain.h @@ -71,20 +71,28 @@ struct shachain { */ void shachain_init(struct shachain *chain); +/** + * shachain_next_index - what's the next index I can add to the shachain? + * @chain: the chain + * + * This returns 0xFFFFFFFFFFFFFFFF (for a freshly + * initialized chain), or one less than the previously successfully + * added value. + */ +shachain_index_t shachain_next_index(const struct shachain *chain); + /** * shachain_add_hash - record the hash for the next index. * @chain: the chain to add to * @index: the index of the hash * @hash: the hash value. * - * You can only add index 0xFFFFFFFFFFFFFFFF (for a freshly - * initialized chain), or one less than the previously successfully - * added value. + * You can only add shachain_next_index(@chain). * * This can fail (return false without altering @chain) if the hash * for this index isn't consistent with previous hashes (ie. wasn't * generated from the same seed), though it can't always detect that. - * If the hash is inconsistent yet undetected, the next addition will + * If the hash is inconsistent yet undetected, a future addition will * fail. * * Example: