Example #1
0
        public async Task <BlockStake> GetAsync(uint256 blockid)
        {
            var stakeItem = new StakeItem {
                BlockId = blockid
            };

            await this.dBreezeCoinView.GetStake(new [] { stakeItem }).ConfigureAwait(false);

            Guard.Assert(stakeItem.BlockStake != null);             // if we ask for it then we expect its in store
            return(stakeItem.BlockStake);
        }
Example #2
0
        public async Task SetAsync(uint256 blockid, BlockStake blockStake)
        {
            if (this.items.ContainsKey(blockid))
            {
                return;
            }

            var chainedBlock = this.chain.GetBlock(blockid);
            var item         = new StakeItem {
                BlockId = blockid, Height = chainedBlock.Height, BlockStake = blockStake, InStore = false
            };
            var added = this.items.TryAdd(blockid, item);

            if (added)
            {
                await this.Flush(false);
            }
        }