anchor.diff:  %%      or the entry in MyEntries has a newer version than the one in the tree
   %%      and returns them as FBItems. ReqItems contains items in the tree but
   %%      where the version in MyEntries is older than the one in the tree.
  --spec get_full_diff
  -        (MyEntries::[], MyIOtherKvTree::kvi_tree(),
  -         AccFBItems::FBItems, AccReqItems::[non_neg_integer()],
  -         SigSize::signature_size(), VSize::signature_size())
  -        -> {FBItems::FBItems, ReqItemsIdx::[non_neg_integer()], MyIOtherKvTree::kvi_tree()}
  -            when is_subtype(FBItems, rr_resolve:kvv_list() | [?RT:key()]);
  -        (MyEntries::'db_chunk_kvv+'(), MyIOtherKvTree::kvi_tree(),
  -         AccFBItems::rr_resolve:kvv_list(), AccReqItems::[non_neg_integer()],
  -         SigSize::signature_size(), VSize::signature_size())
  -        -> {FBItems::rr_resolve:kvv_list(), ReqItemsIdx::[non_neg_integer()], MyIOtherKvTree::kvi_tree()};
  -        (MyEntries::'db_chunk_kv+'(), MyIOtherKvTree::kvi_tree(),
  -         AccFBItems::[?RT:key()], AccReqItems::[non_neg_integer()],
  -         SigSize::signature_size(), VSize::signature_size())
  -        -> {FBItems::[?RT:key()], ReqItemsIdx::[non_neg_integer()], MyIOtherKvTree::kvi_tree()}.
  +-spec get_full_diff(MyEntries::db_chunk_kv(), MyIOtherKvTree::kvi_tree(),
  +                    AccFBItems::[?RT:key()], AccReqItems::[non_neg_integer()],
  +                    SigSize::signature_size(), VSize::signature_size())
  +        -> {FBItems::[?RT:key()], ReqItemsIdx::[non_neg_integer()],
  +            MyIOtherKvTree::kvi_tree()}.
   get_full_diff(MyEntries, MyIOtKvTree, FBItems, ReqItemsIdx, SigSize, VSize) ->
       get_full_diff_(MyEntries, MyIOtKvTree, FBItems, ReqItemsIdx, SigSize,
                     util:pow(2, VSize)).
   
   %% @doc Helper for get_full_diff/6.
  --spec get_full_diff_
  -        (MyEntries::[], MyIOtherKvTree::kvi_tree(),
  -         AccFBItems::FBItems, AccReqItems::[non_neg_integer()],
  -         SigSize::signature_size(), VMod::pos_integer())
  -        -> {FBItems::FBItems, ReqItemsIdx::[non_neg_integer()], MyIOtherKvTree::kvi_tree()}
  -            when is_subtype(FBItems, rr_resolve:kvv_list() | [?RT:key()]);
  -        (MyEntries::'db_chunk_kvv+'(), MyIOtherKvTree::kvi_tree(),
  -         AccFBItems::rr_resolve:kvv_list(), AccReqItems::[non_neg_integer()],
  -         SigSize::signature_size(), VMod::pos_integer())
  -        -> {FBItems::rr_resolve:kvv_list(), ReqItemsIdx::[non_neg_integer()], MyIOtherKvTree::kvi_tree()};
  -        (MyEntries::'db_chunk_kv+'(), MyIOtherKvTree::kvi_tree(),
  -         AccFBItems::[?RT:key()], AccReqItems::[non_neg_integer()],
  -         SigSize::signature_size(), VMod::pos_integer())
  -        -> {FBItems::[?RT:key()], ReqItemsIdx::[non_neg_integer()], MyIOtherKvTree::kvi_tree()}.
  +-spec get_full_diff_(MyEntries::db_chunk_kv(), MyIOtherKvTree::kvi_tree(),
  +                     AccFBItems::[?RT:key()], AccReqItems::[non_neg_integer()],
  +                     SigSize::signature_size(), VMod::pos_integer())
  +        -> {FBItems::[?RT:key()], ReqItemsIdx::[non_neg_integer()],
  +            MyIOtherKvTree::kvi_tree()}.
   get_full_diff_([], MyIOtKvTree, FBItems, ReqItemsIdx, _SigSize, _VMod) ->
       {FBItems, ReqItemsIdx, MyIOtKvTree};
  -get_full_diff_([Tpl | Rest], MyIOtKvTree, FBItems, ReqItemsIdx, SigSize, VMod) ->
  -    Key = element(1, Tpl),
  -    Version = element(2, Tpl),
  -    TplSize = tuple_size(Tpl),
  +get_full_diff_([{Key, Version} | Rest], MyIOtKvTree, FBItems, ReqItemsIdx, SigSize, VMod) ->
       {KeyBin, VersionShort} = compress_kv_pair(Key, Version, SigSize, VMod),
       case gb_trees:lookup(KeyBin, MyIOtKvTree) of
  -        none when TplSize =:= 3 ->
  -            Value = element(3, Tpl),
  -            get_full_diff_(Rest, MyIOtKvTree, [{Key, Value, Version} | FBItems],
  -                           ReqItemsIdx, SigSize, VMod);
  -        none when TplSize =:= 2 ->
  +        none ->
               get_full_diff_(Rest, MyIOtKvTree, [Key | FBItems],
                              ReqItemsIdx, SigSize, VMod);
           {value, {OtherVersionShort, Idx}} ->
               MyIOtKvTree2 = gb_trees:delete(KeyBin, MyIOtKvTree),
  -            if VersionShort > OtherVersionShort andalso TplSize =:= 3 ->
  -                   Value = element(3, Tpl),
  -                   get_full_diff_(Rest, MyIOtKvTree2, [{Key, Value, Version} | FBItems],
  -                                  ReqItemsIdx, SigSize, VMod);
  -               VersionShort > OtherVersionShort andalso TplSize =:= 2 ->
  +            if VersionShort > OtherVersionShort ->
                      get_full_diff_(Rest, MyIOtKvTree2, [Key | FBItems],
                                     ReqItemsIdx, SigSize, VMod);
                  VersionShort =:= OtherVersionShort ->
  
positive.code:                           sync_finished_remote. %client-side shutdown by merkle-tree recon initiator
  
  -type db_chunk_kv()    :: [{?RT:key(), client_version()}].
  -type 'db_chunk_kv+'() :: [{?RT:key(), client_version()},...].
  -type db_chunk_kvv()   :: [{?RT:key(), client_version(), db_dht:value()}].
  -type 'db_chunk_kvv+'():: [{?RT:key(), client_version(), db_dht:value()},...].
  
  -type signature_size() :: 0..160. % use an upper bound of 160 (SHA-1) to limit automatic testing
  -type kvi_tree()       :: gb_trees:tree(KeyBin::bitstring(), {VersionShort::non_neg_integer(), Idx::non_neg_integer()}).
  
negative.code: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % type definitions
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  -export_type([method/0, request/0]).
  
  -type method()         :: trivial | shash | bloom | merkle_tree | art.% | iblt.
  -type stage()          :: req_shared_interval | build_struct | reconciliation | resolve.
  