Proof using.
unfold handleAppendEntries.
intros.
repeat break_match; find_inversion; intro; break_exists; discriminate.
Qed.

Lemma handleMessage_sends_log :
forall client id i net p d' ms m es e,
In p (nwPackets net) ->
handleMessage (pSrc p) (pDst p) (pBody p) (nwState net (pDst p)) = (d', ms) ->
correct_entry client id i e ->
In m ms ->
mEntries (snd m) = Some es ->
In e es ->
In e (log (nwState net (pDst p))).