private ScannedItems GetScannedItems(ScanUTXOWorkItem workItem, ScanUTXOProgress progress) { var items = new ScannedItems(); var derivationStrategy = workItem.DerivationStrategy; foreach (var feature in workItem.Options.DerivationFeatures) { var path = DerivationStrategyBase.GetKeyPath(feature); var lineDerivation = workItem.DerivationStrategy.DerivationStrategy.GetLineFor(feature); Enumerable.Range(progress.From, progress.Count) .Select(index => { var derivation = lineDerivation.Derive((uint)index); var info = new KeyPathInformation() { ScriptPubKey = derivation.ScriptPubKey, Redeem = derivation.Redeem, TrackedSource = derivationStrategy, DerivationStrategy = derivationStrategy.DerivationStrategy, Feature = feature, KeyPath = path.Derive(index, false) }; items.Descriptors.Add(new ScanTxoutSetObject(ScanTxoutDescriptor.Raw(info.ScriptPubKey))); items.KeyPathInformations.TryAdd(info.ScriptPubKey, info); return(info); }).All(_ => true); } Logs.Explorer.LogInformation($"{workItem.Network.CryptoCode}: Start scanning batch {progress.BatchNumber} of {workItem.DerivationStrategy.ToPrettyString()} from index {progress.From}"); return(items); }
internal static KeyPathInformation AddAddress(this KeyPathInformation keyPathInformation, Network network) { if (keyPathInformation.Address == null) { keyPathInformation.Address = keyPathInformation.ScriptPubKey.GetDestinationAddress(network).ToString(); } return(keyPathInformation); }
public void CanSerializeKeyPathFast() { using (var tester = RepositoryTester.Create(true)) { var seria = new Serializer(Network.RegTest); var keyInfo = new KeyPathInformation() { DerivationStrategy = DummyPubKey, Feature = DerivationFeature.Change, KeyPath = new KeyPath("0/1"), Redeem = Script.Empty, ScriptPubKey = Script.Empty }; var str = seria.ToString(keyInfo); for (int i = 0; i < 1500; i++) { seria.ToObject <KeyPathInformation>(str); } } }
private ScannedItems GetScannedItems(ScanUTXOWorkItem workItem, ScanUTXOProgress progress, NBXplorerNetwork network) { var items = new ScannedItems(); var derivationStrategy = workItem.DerivationStrategy; foreach (var feature in keyPathTemplates.GetSupportedDerivationFeatures()) { var keyPathTemplate = keyPathTemplates.GetKeyPathTemplate(feature); var lineDerivation = workItem.DerivationStrategy.DerivationStrategy.GetLineFor(keyPathTemplate); Enumerable.Range(progress.From, progress.Count) .Select(index => { var derivation = lineDerivation.Derive((uint)index); var info = new KeyPathInformation(derivation, derivationStrategy, feature, keyPathTemplate.GetKeyPath(index, false), network); items.Descriptors.Add(new ScanTxoutSetObject(ScanTxoutDescriptor.Raw(info.ScriptPubKey))); items.KeyPathInformations.TryAdd(info.ScriptPubKey, info); return(info); }).All(_ => true); } Logs.Explorer.LogInformation($"{workItem.Network.CryptoCode}: Start scanning batch {progress.BatchNumber} of {workItem.DerivationStrategy.ToPrettyString()} from index {progress.From}"); return(items); }
private void Set(WalletId walletId, KeyPathInformation information) { _walletReceiveState.AddOrReplace(walletId, information); }
public static void MarkAsUsed(this Repository repo, KeyPathInformation info) { repo.MarkAsUsedAsync(new KeyPathInformation[] { info }).GetAwaiter().GetResult(); }