Пример #1
0
        private static void HandleSwitchGenerateFundsRecoveryTransaction(string[] args)
        {
            ConfigReader = new TextFileConfiguration(args);

            // datadir = Directory of old federation.
            ConfirmArguments(ConfigReader, "network", "datadir", "fedpubkeys", "quorum", "password", "txtime");

            Script newRedeemScript = GetRedeemScriptFromArguments();
            string password        = GetPasswordFromArguments();

            string dataDirPath = GetDataDirFromArguments();

            (Network mainChain, Network sideChain) = GetMainAndSideChainNetworksFromArguments();

            DateTime txTime = GetTransactionTimeFromArguments();

            Console.WriteLine($"Creating funds recovery transaction for {sideChain.Name}.");
            FundsRecoveryTransactionModel sideChainInfo = (new RecoveryTransactionCreator()).CreateFundsRecoveryTransaction(true, sideChain, mainChain, dataDirPath, newRedeemScript, password, txTime);

            sideChainInfo.DisplayInfo();

            Console.WriteLine($"Creating funds recovery transaction for {mainChain.Name}.");
            FundsRecoveryTransactionModel mainChainInfo = (new RecoveryTransactionCreator()).CreateFundsRecoveryTransaction(false, mainChain, sideChain, dataDirPath, newRedeemScript, password, txTime);

            mainChainInfo.DisplayInfo();
        }
Пример #2
0
        private static void HandleSwitchGenerateFundsRecoveryTransaction(string[] args, bool newFormat = false)
        {
            ConfigReader = new TextFileConfiguration(args);

            // datadir = Directory of old federation.
            if (newFormat)
            {
                ConfirmArguments(ConfigReader, "network", "datadir", "fedpubkeys", "password", "txtime");
            }
            else
            {
                ConfirmArguments(ConfigReader, "network", "datadir", "fedpubkeys", "quorum", "password", "txtime");
            }

            PayToMultiSigTemplateParameters para = new PayToMultiSigTemplateParameters()
            {
                PubKeys        = GetFederatedPublicKeysFromArguments().Select(p => new PubKey(p)).ToArray(),
                SignatureCount = newFormat ? 0 : GetQuorumFromArguments()
            };

            string password = GetPasswordFromArguments();

            string dataDirPath = GetDataDirFromArguments();

            (Network mainChain, Network sideChain) = GetMainAndSideChainNetworksFromArguments();

            DateTime txTime = GetTransactionTimeFromArguments();

            Console.WriteLine($"Creating funds recovery transaction for {sideChain.Name}.");
            FundsRecoveryTransactionModel sideChainInfo = (new RecoveryTransactionCreator()).CreateFundsRecoveryTransaction(true, sideChain, mainChain, dataDirPath, para, password, txTime, newFormat);

            sideChainInfo.DisplayInfo();

            Console.WriteLine($"Creating funds recovery transaction for {mainChain.Name}.");
            FundsRecoveryTransactionModel mainChainInfo = (new RecoveryTransactionCreator()).CreateFundsRecoveryTransaction(false, mainChain, sideChain, dataDirPath, para, password, txTime, newFormat, true);

            mainChainInfo.DisplayInfo();
        }