viff

changeset 1351:46ffe8878fbf

Orlandi:Replace sharelist with gather_share.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 27 Oct 2009 20:42:45 +0100
parents 43d0f2a811e1
children f19dce86dc4d
files viff/orlandi.py
diffstat 1 files changed, 5 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/viff/orlandi.py	Tue Oct 27 20:24:26 2009 +0100
     1.2 +++ b/viff/orlandi.py	Tue Oct 27 20:42:45 2009 +0100
     1.3 @@ -131,21 +131,13 @@
     1.4          rhoi1 = self._expect_share(peer_id, field)
     1.5          rhoi2 = self._expect_share(peer_id, field)
     1.6          self._expect_data(peer_id, TEXT, Cx)
     1.7 -        sls = ShareList([xi, rhoi1, rhoi2, Cx])
     1.8 +        sls = gather_shares([xi, rhoi1, rhoi2, Cx])
     1.9          def combine(ls):
    1.10 -            expected_num = 4;
    1.11 -            if len(ls) is not expected_num:
    1.12 -                raise OrlandiException("Cannot share number, trying to create a share,"
    1.13 -                                       " expected %s components got %s."
    1.14 -                                       % (expected_num, len(ls)))
    1.15 -            s1, xi = ls[0]
    1.16 -            s2, rhoi1 = ls[1]
    1.17 -            s3, rhoi2 = ls[2]
    1.18 -            s4, Cx = ls[3]
    1.19 +            xi = ls[0]
    1.20 +            rhoi1 = ls[1]
    1.21 +            rhoi2 = ls[2]
    1.22 +            Cx = ls[3]
    1.23              Cxx = commitment.deserialize(Cx)
    1.24 -            if not (s1 and s2 and s3 and s4):
    1.25 -                raise OrlandiException("Cannot share number, trying to create share,"
    1.26 -                                       " but a component did arrive properly.")
    1.27              return OrlandiShare(self, field, xi, (rhoi1, rhoi2), Cxx)
    1.28          sls.addCallbacks(combine, self.error_handler)
    1.29          return sls