コード例 #1
0
        public static IEnumerable <(string Labels, ICoinsView Coins)> GetPockets(ICoinsView allCoins)
        {
            var clusters = allCoins.GroupBy(x => x.HdPubKey.Cluster.Labels);

            List <(string Labels, ICoinsView Coins)> pockets = new();

            foreach (var cluster in clusters)
            {
                string      allLabels = cluster.Key.ToString();
                SmartCoin[] coins     = cluster.ToArray();

                if (string.IsNullOrWhiteSpace(allLabels))
                {
                    // If the Label is empty then add every coin as a separate pocket
                    foreach (var coin in coins)
                    {
                        pockets.Add(new("", new CoinsView(new[] { coin })));
                    }
                }
                else
                {
                    pockets.Add(new(allLabels, new CoinsView(coins)));
                }
            }
            return(pockets);
        }
コード例 #2
0
 /// <param name="allowUnconfirmed">Allow to spend unconfirmed transactions, if necessary.</param>
 public TransactionFactory(Network network, KeyManager keyManager, ICoinsView coins, string password = "", bool allowUnconfirmed = false)
 {
     Network          = network;
     KeyManager       = keyManager;
     Coins            = coins;
     Password         = password;
     AllowUnconfirmed = allowUnconfirmed;
 }
コード例 #3
0
 /// <param name="allowUnconfirmed">Allow to spend unconfirmed transactions, if necessary.</param>
 public TransactionFactory(Network network, KeyManager keyManager, ICoinsView coins, AllTransactionStore transactionStore, string password = "", bool allowUnconfirmed = false)
 {
     Network          = Guard.NotNull(nameof(network), network);
     KeyManager       = Guard.NotNull(nameof(keyManager), keyManager);
     Coins            = Guard.NotNull(nameof(coins), coins);
     TransactionStore = Guard.NotNull(nameof(transactionStore), transactionStore);
     Password         = password;
     AllowUnconfirmed = allowUnconfirmed;
 }
コード例 #4
0
        public ChainState(ILogger <ChainState> logger,
                          IHeadersTree headersTree,
                          ICoinsView coinsView,
                          IBlockHeaderRepository blockHeaderRepository,
                          IConsensusParameters consensusParameters)
        {
            this.logger            = logger;
            HeadersTree            = headersTree;
            this.coinsView         = coinsView;
            _blockHeaderRepository = blockHeaderRepository;
            _consensusParameters   = consensusParameters;
            ChainTip   = headersTree.Genesis;
            BestHeader = headersTree.Genesis;

            _blockHeaderRepository.TryAdd(consensusParameters.GenesisHeader);
        }