From 14f63db4da9614f5d8a7634469bc794489e32621 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 16 Oct 2019 09:15:55 -0400
Subject: [PATCH] respect sharenums

---
 src/_zkapauthorizer/_storage_server.py           | 3 ++-
 src/_zkapauthorizer/tests/test_storage_server.py | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/_zkapauthorizer/_storage_server.py b/src/_zkapauthorizer/_storage_server.py
index e1591a3..8de998e 100644
--- a/src/_zkapauthorizer/_storage_server.py
+++ b/src/_zkapauthorizer/_storage_server.py
@@ -475,7 +475,8 @@ def get_share_sizes(storage_server, storage_index_or_slot, sharenums):
                     get_size = get_slot_share_size
                 else:
                     get_size = get_storage_index_share_size
-        yield sharenum, get_size(sharepath)
+        if sharenum in sharenums:
+            yield sharenum, get_size(sharepath)
 
 
 def get_storage_index_share_size(sharepath):
diff --git a/src/_zkapauthorizer/tests/test_storage_server.py b/src/_zkapauthorizer/tests/test_storage_server.py
index fa05fe4..d7eb0a4 100644
--- a/src/_zkapauthorizer/tests/test_storage_server.py
+++ b/src/_zkapauthorizer/tests/test_storage_server.py
@@ -535,6 +535,7 @@ class PassValidationTests(TestCase):
             sharenum: get_implied_data_length(data_vector, new_length)
             for (sharenum, (testv, data_vector, new_length))
             in tw_vectors.items()
+            if sharenum in sharenums
         }
 
         actual_sizes = self.storage_server.doRemoteCall(
-- 
GitLab