private static Gen <TxOut> OutputFromRedeem(Script sc) => from money in MoneyGenerator.Money() from isP2WSH in PrimitiveGenerator.Bool() from isP2SH in PrimitiveGenerator.Bool() where isP2WSH || isP2SH let redeem = (isP2SH && isP2WSH) ? sc.WitHash.ScriptPubKey : sc let scriptPubKey = isP2SH ? redeem.Hash.ScriptPubKey : redeem.WitHash.ScriptPubKey select new TxOut(money, scriptPubKey);
private static Gen <TxOut> OutputFromKey(PubKey key) => from money in MoneyGenerator.Money() from isP2WPKH in PrimitiveGenerator.Bool() from isP2SH in PrimitiveGenerator.Bool() let scriptPubKey = (isP2SH && isP2WPKH) ? key.WitHash.ScriptPubKey.Hash.ScriptPubKey : isP2WPKH ? key.WitHash.ScriptPubKey : key.Hash.ScriptPubKey select new TxOut(money, scriptPubKey);