[mle] restore operational datasets when becoming leader (#5036)

The leader is authoritative in the operational datasets that it
distributes. This commit ensures that a device becoming a leader
restores the operational dataset from non-volatile. This ensures that
the operational datasets that the leader attempts to distribute are
the same as in its non-volatile storage.
This commit is contained in:
Jonathan Hui
2020-06-02 13:37:54 -07:00
committed by GitHub
parent aa19e77ac7
commit 0565f44a4c
+2
View File
@@ -337,6 +337,8 @@ void MleRouter::SetStateRouter(uint16_t aRloc16)
void MleRouter::SetStateLeader(uint16_t aRloc16)
{
IgnoreError(Get<MeshCoP::ActiveDataset>().Restore());
IgnoreError(Get<MeshCoP::PendingDataset>().Restore());
SetRloc16(aRloc16);
SetRole(kRoleLeader);