public PromiseClientSession(PromiseParameters parameters, State state) : this(parameters) { if (state == null) { return; } InternalState = Serializer.Clone(state); if (InternalState.Commitments != null) { _Hashes = new HashBase[InternalState.Commitments.Length]; int fakeI = 0, realI = 0; for (int i = 0; i < _Hashes.Length; i++) { HashBase hash = null; if (InternalState.FakeIndexes != null && InternalState.FakeIndexes.Contains(i)) { hash = new FakeHash(_Parameters) { Salt = InternalState.FakeSalts[fakeI++] }; } else { hash = new RealHash(InternalState.Cashout, InternalState.EscrowedCoin) { FeeVariation = InternalState.FeeVariations[realI++] }; } hash.Index = i; hash.Commitment = InternalState.Commitments[i]; _Hashes[i] = hash; } } }
public FakeHash(PromiseParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } Parameters = parameters; }
public PromiseServerSession(State state, PromiseParameters parameters) : this(parameters) { if (state == null) { throw new ArgumentNullException(nameof(state)); } InternalState = state; }
public PromiseServerSession(PromiseParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } _Parameters = parameters; InternalState = new State(); }
private HashBase[][] _Hashes; // The list of Hashes (Beta_i in the paper) public PromiseClientSession(PromiseParameters parameters, State state) : this(parameters) { if (state == null) { return; } InternalState = Serializer.Clone(state); if (InternalState.Commitments != null) { _Hashes = new HashBase[parameters.PaymentsCount][]; for (int i = 0; i < _Hashes.Length; i++) { _Hashes[i] = new HashBase[InternalState.Commitments[i].Length]; int fakeJ = 0, realJ = 0; for (int j = 0; j < _Hashes[i].Length; j++) { HashBase hash = null; if (InternalState.FakeColumns != null && InternalState.FakeColumns.Contains(j)) { hash = new FakeHash(parameters) { Salt = InternalState.Salts[i][fakeJ++] }; } else { hash = new RealHash(InternalState.Cashout, InternalState.EscrowedCoin) { FeeVariation = InternalState.FeeVariations[i][realJ++] }; } hash.Index = j; hash.Commitment = InternalState.Commitments[i][j]; _Hashes[i][j] = hash; } } } }
public PromiseClientSession(PromiseParameters parameters = null) { _Parameters = parameters ?? new PromiseParameters(); InternalState = new State(); }
public FakeHash(PromiseParameters parameters) { Parameters = parameters ?? throw new ArgumentNullException(nameof(parameters)); }
public PromiseClientSession(Network network, PromiseParameters parameters = null) { _Network = network; _Parameters = parameters ?? new PromiseParameters(); InternalState = new State(); }