Пример #1
0
        public void CheckSolutions(Transaction fulfillTx)
        {
            if (fulfillTx == null)
            {
                throw new ArgumentNullException(nameof(fulfillTx));
            }

            AssertState(SolverClientStates.WaitingPuzzleSolutions);
            foreach (var input in fulfillTx.Inputs)
            {
                var solutions = SolverScriptBuilder.ExtractSolutions(input.ScriptSig, Parameters.RealPuzzleCount);
                if (solutions == null)
                {
                    continue;
                }
                try
                {
                    CheckSolutions(solutions);
                    return;
                }
                catch (PuzzleException)
                {
                }
            }
            throw new PuzzleException("Impossible to find solution to the puzzle");
        }
Пример #2
0
        public void CheckSolutions(Script scriptSig)
        {
            if (scriptSig == null)
            {
                throw new ArgumentNullException(nameof(scriptSig));
            }
            AssertState(SolverClientStates.WaitingPuzzleSolutions);
            var solutions = SolverScriptBuilder.ExtractSolutions(scriptSig, Parameters.RealPuzzleCount);

            if (solutions == null)
            {
                throw new PuzzleException("Impossible to find solution to the puzzle");
            }
            CheckSolutions(solutions);
        }