commit 397c3ce19e904369508a05501dbb6e6ff69dd944 Author: Damian Johnson atagar@torproject.org Date: Sat Jul 7 12:00:09 2018 -0700
Note that excluding 'unsued' from cell equality is intentional
Great question from Dave that could do with some clarification...
18:51 < dmr> atagar: (1) I noticed that __hash__() doesn't include `unused` in its calculations. Should it?
18:54 <+atagar> (1) is a very good question and I was wondering if you were gonna ask it at some point. That boils down to 'if two tor cells have the same content *but* have differing filler bytes are they equal?'. A pure python approach says 'no, the objects aren't equal' but behavior wise our users probably expect that 'yes, they are'. So I purposefully left it out but it's a very good question. Maybe I should add a comment there since otherwise it does indeed look like an oversight. --- stem/client/cell.py | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/stem/client/cell.py b/stem/client/cell.py index 337e8a2d..83019621 100644 --- a/stem/client/cell.py +++ b/stem/client/cell.py @@ -77,6 +77,9 @@ class Cell(object): """ Metadata for ORPort cells.
+ Unused padding are **not** used in equality checks or hashing. If two cells + differ only in their *unused* attribute they are functionally equal. + :var bytes unused: unused filler that padded the cell to the expected size """
tor-commits@lists.torproject.org