Here is what we need to do.
TokenMetadata currently uses a slightly fragile combination of a Set of nodes known to be bootstrapping, and a Map of their tokens -> inetaddress, to determine the ranges Bootstrap nodes are concerned with (for
We need to change that to instead have a Map of Range -> inetaddress, representing "these are ranges that the given node doesn't own yet, but will, so send updates in that range there as well as its current destinations."
That allows us to use the same structure for bootstrap (new node X gets these ranges, where before it had none) and unbootstrap (existing node Y gets X's ranges, as well as its existing ones).
Then actually implementing unbootstrap is just wiring up the streaming from one node to another. See comments in the header of BootStrapper.java for the different moving parts involved in bootstrap; the process is basically the same. (Even to requiring anticompaction to split out the different replica ranges.)