示例#1
0
        public void RegisterFederation(IFederation federation)
        {
            // TODO: Remove this when multiple federations are supported.
            this.federations.Clear();

            this.federations[federation.Id] = federation;
        }
        public static bool TryGetDepositsToMultisig(Network network, Transaction transaction, Money crossChainTransferMinimum, out List <TxOut> depositsToMultisig)
        {
            depositsToMultisig = null;

            // Coinbase transactions can't have deposits.
            if (transaction.IsCoinBase)
            {
                return(false);
            }

            // Deposits have a certain structure.
            if (transaction.Outputs.Count != ExpectedNumberOfOutputsNoChange && transaction.Outputs.Count != ExpectedNumberOfOutputsChange)
            {
                return(false);
            }

            IFederation federation = network.Federations?.GetOnlyFederation();

            if (federation == null)
            {
                return(false);
            }

            var depositScript = PayToFederationTemplate.Instance.GenerateScriptPubKey(federation.Id).PaymentScript;

            depositsToMultisig = transaction.Outputs.Where(output =>
                                                           output.ScriptPubKey == depositScript &&
                                                           output.Value >= crossChainTransferMinimum).ToList();

            return(depositsToMultisig.Any());
        }