Channel drops were not checking whether forks done in the same transaction before dropping unused patches
Dependencies
- [2]
G6YXRFH2Channel drop with tags - [3]
RRCSHAYZFormatting - [4]
NGCTMCDPcleaning up the deps and revdeps of unused changes after a channel drop - [5]
TZ42DX3BProperly dropping a channel - [6]
VSOT2QH5Fixing channel drop (cleanup in other tables + order of reference drop) - [*]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting).
Change contents
- edit in libpijul/src/pristine/sanakirja.rs at line 1918
debug!(target: "drop_channel", "drop channel {:?}", name0); - replacement in libpijul/src/pristine/sanakirja.rs at line 1953
for chan in self.iter_channels("").map_err(|e| e.0)? {let (name, chan) = chan.map_err(|e| e.0)?;debug!(target: "drop_channel", "testing unused change: {:?}", p);let mut it0 = self.iter_channels("").map_err(|e| e.0)?;let it1 = self.open_channels.lock();let mut it1 = it1.iter();loop {let (name, chan) = if let Some(chan) = it0.next() {chan.map_err(|e| e.0)?} else if let Some((name, chan)) = it1.next() {(name.as_ref(), chan.clone())} else {break};debug!(target: "drop_channel", "channel: {:?}", name); - edit in libpijul/src/pristine/sanakirja.rs at line 1973
// This other channel is in the same state as// our dropped channel is, so all subsequent// patches are in use. - edit in libpijul/src/pristine/sanakirja.rs at line 1983
// This channel has a patch, move on. - edit in libpijul/src/pristine/sanakirja.rs at line 1987
debug!(target: "drop_channel", "actually unused: {:?}", p); - replacement in libpijul/src/pristine/sanakirja.rs at line 2001
btree::del(&mut self.txn, &mut self.revdep, &k, Some(&v))?;debug!(target: "drop_channel", "deleting from revdep: {:?} {:?}", k, v);btree::del(&mut self.txn, &mut self.dep, &k, Some(&v))?;