context UPDATE modules' enabled features and imp state part of hash
diff --git a/src/context.c b/src/context.c
index 05b16f6..b0d8dcc 100644
--- a/src/context.c
+++ b/src/context.c
@@ -673,15 +673,29 @@
ly_ctx_get_modules_hash(const struct ly_ctx *ctx)
{
const struct lys_module *mod;
- uint32_t i = ly_ctx_internal_modules_count(ctx), hash = 0;
+ uint32_t i = ly_ctx_internal_modules_count(ctx), hash = 0, fi = 0;
+ struct lysp_feature *f = NULL;
LY_CHECK_ARG_RET(ctx, ctx, 0);
while ((mod = ly_ctx_get_module_iter(ctx, &i))) {
+ /* name */
hash = dict_hash_multi(hash, mod->name, strlen(mod->name));
+
+ /* revision */
if (mod->revision) {
hash = dict_hash_multi(hash, mod->revision, strlen(mod->revision));
}
+
+ /* enabled features */
+ while ((f = lysp_feature_next(f, mod->parsed, &fi))) {
+ if (f->flags & LYS_FENABLED) {
+ hash = dict_hash_multi(hash, f->name, strlen(f->name));
+ }
+ }
+
+ /* imported/implemented */
+ hash = dict_hash_multi(hash, (char *)&mod->implemented, sizeof mod->implemented);
}
hash = dict_hash_multi(hash, NULL, 0);
diff --git a/src/context.h b/src/context.h
index ec5ac3b..ef78371 100644
--- a/src/context.h
+++ b/src/context.h
@@ -370,9 +370,12 @@
LIBYANG_API_DECL uint16_t ly_ctx_get_change_count(const struct ly_ctx *ctx);
/**
- * @brief Get the hash of all the modules in the context with their revision. Since order of the modules is significant,
+ * @brief Get the hash of all the modules in the context. Since order of the modules is significant,
* even when 2 contexts have the same modules but loaded in a different order, the hash will differ.
*
+ * Hash consists of all module names (1), their revisions (2), all enabled features (3), and their
+ * imported/implemented state (4).
+ *
* @param[in] ctx Context to be examined.
* @return Context modules hash.
*/