GetNextTwoProtocolId() public method

public GetNextTwoProtocolId ( Quorum other, bool incrementOther = true ) : ulong
other Quorum
incrementOther bool
return ulong
示例#1
0
文件: Quorum.cs 项目: mahdiz/mpclib
        public ulong GetNextTwoProtocolId(Quorum other, bool incrementOther = true)
        {
            if (this == other)
            {
                return(GetNextProtocolId());
            }

            if (!TwoQuorumProtocolIds.ContainsKey(other))
            {
                TwoQuorumProtocolIds[other] = 0;
            }

            // if we are failing this assert, we need to expand the range
            Debug.Assert(TwoQuorumProtocolIds[other] <= ushort.MaxValue);

            ulong retId = ProtocolIdGenerator.TwoQuorumProtocolIdentifier(QuorumNumber, other.QuorumNumber, TwoQuorumProtocolIds[other]);

            TwoQuorumProtocolIds[other]++;

            // increment the id in the other quorum (necessary because a party may be part of both quorums)
            if (incrementOther)
            {
                other.GetNextTwoProtocolId(this, false);
            }

            return(retId);
        }
示例#2
0
文件: Quorum.cs 项目: mahdiz/mpclib
        public ulong GetNextTwoProtocolId(Quorum other, bool incrementOther = true)
        {
            if (this == other)
                return GetNextProtocolId();

            if (!TwoQuorumProtocolIds.ContainsKey(other))
                TwoQuorumProtocolIds[other] = 0;

            // if we are failing this assert, we need to expand the range
            Debug.Assert(TwoQuorumProtocolIds[other] <= ushort.MaxValue);

            ulong retId = ProtocolIdGenerator.TwoQuorumProtocolIdentifier(QuorumNumber, other.QuorumNumber, TwoQuorumProtocolIds[other]);
            TwoQuorumProtocolIds[other]++;

            // increment the id in the other quorum (necessary because a party may be part of both quorums)
            if (incrementOther)
               other.GetNextTwoProtocolId(this, false);

            return retId;
        }