public static Gen <HDKeyPathKVMap> HDKeyPaths() => from itemNum in Gen.Choose(0, 15) from pks in Gen.ListOf(itemNum, CryptoGenerator.PublicKey()) from map in HDKeyPaths(pks, itemNum) select map;
public static Gen <HDKeyPathKVMap> HDKeyPaths(IEnumerable <PubKey> pks, int itemNum) => from MasterKeyFingerPrints in Gen.ListOf(itemNum, Utils.HDFingerprint()) from paths in Gen.ListOf(itemNum, CryptoGenerator.KeyPath()) let fingerPrintAndPath = MasterKeyFingerPrints.ToArray().Zip(paths.ToArray(), (m, p) => Tuple.Create(m, p)).ToList() select Utils.DictionaryFromList <PubKey, Tuple <HDFingerprint, KeyPath> >(pks.ToList(), fingerPrintAndPath);
public static Gen <Dictionary <KeyId, Tuple <PubKey, ECDSASignature> > > PartialSigs() => from itemNum in Gen.Choose(0, 15) from sigs in CryptoGenerator.ECDSAs(itemNum) from pks in CryptoGenerator.PublicKeys(itemNum) let items = pks.ToList().Zip(sigs.ToList(), (pk, sig) => Tuple.Create(pk, sig)).ToList() select Utils.DictionaryFromList <KeyId, Tuple <PubKey, ECDSASignature> >(pks.Select(pk => pk.Hash).ToList(), items);
public static Gen <OutPoint> OutPoint() => from txid in CryptoGenerator.Hash256() from vout in Gen.Choose(0, Int32.MaxValue) select new OutPoint(txid, vout);