public override Coins AccessCoins(uint256 txId) { using (StopWatch.Instance.Start(o => PerformanceCounter.AddQueryTime(o))) { using (var tx = _Engine.GetTransaction()) { tx.ValuesLazyLoadingIsOn = false; PerformanceCounter.AddQueriedEntities(1); return(tx.Select <byte[], Coins>("Coins", txId.ToBytes(false))?.Value); } } }
public override Coins[] FetchCoins(uint256[] txIds) { using (StopWatch.Instance.Start(o => PerformanceCounter.AddQueryTime(o))) { Coins[] result = new Coins[txIds.Length]; using (var txx = _Engine.GetTransaction()) { txx.ValuesLazyLoadingIsOn = false; int i = 0; foreach (var input in txIds) { PerformanceCounter.AddQueriedEntities(1); result[i++] = txx.Select <byte[], Coins>("Coins", input.ToBytes(false))?.Value; } } return(result); } }
public override Task <FetchCoinsResponse> FetchCoinsAsync(uint256[] txIds) { return(_Session.Do(() => { using (StopWatch.Instance.Start(o => PerformanceCounter.AddQueryTime(o))) { var blockHash = GetCurrentHash(); UnspentOutputs[] result = new UnspentOutputs[txIds.Length]; int i = 0; PerformanceCounter.AddQueriedEntities(txIds.Length); foreach (var input in txIds) { var coin = _Session.Transaction.Select <byte[], Coins>("Coins", input.ToBytes(false))?.Value; result[i++] = coin == null ? null : new UnspentOutputs(input, coin); } return new FetchCoinsResponse(result, blockHash); } })); }
public override UnspentOutputs[] FetchCoins(uint256[] txIds) { if (txIds.Length == 0) { return(NoOutputs); } using (StopWatch.Instance.Start(o => PerformanceCounter.AddQueryTime(o))) { UnspentOutputs[] result = new UnspentOutputs[txIds.Length]; using (var txx = _Engine.GetTransaction()) { txx.ValuesLazyLoadingIsOn = false; int i = 0; foreach (var input in txIds) { PerformanceCounter.AddQueriedEntities(1); var coin = txx.Select <byte[], Coins>("Coins", input.ToBytes(false))?.Value; result[i++] = coin == null ? null : new UnspentOutputs(input, coin); } } return(result); } }