Exemple #1
0
 public bool IsRelatedKey(PubKey pk) =>
 HDKeyPaths.ContainsKey(pk) ||                                                    // in HDKeyPathMap or
 pk.Hash.ScriptPubKey.Equals(ScriptPubKey) ||                                     // matches as p2pkh or
 pk.WitHash.ScriptPubKey.Equals(ScriptPubKey) ||                                  // as p2wpkh or
 pk.WitHash.ScriptPubKey.Hash.ScriptPubKey.Equals(ScriptPubKey) ||                // as p2sh-p2wpkh
 (RedeemScript != null && pk.WitHash.ScriptPubKey.Equals(RedeemScript)) ||        // as p2sh-p2wpkh or
 (RedeemScript != null && RedeemScript.GetAllPubKeys().Any(p => p.Equals(pk))) || // more paranoia check (Probably unnecessary)
 (WitnessScript != null && WitnessScript.GetAllPubKeys().Any(p => p.Equals(pk)));
Exemple #2
0
        public bool IsRelatedKey(PubKey pubkey)
        {
            var scriptPubKey = GetProbableScriptPubKey();

            return(HDKeyPaths.ContainsKey(pubkey) ||                                                    // in HDKeyPathMap or
                   pubkey.Hash.ScriptPubKey.Equals(scriptPubKey) ||                                     // matches as p2pkh or
                   pubkey.WitHash.ScriptPubKey.Equals(scriptPubKey) ||                                  // as p2wpkh or
                   pubkey.WitHash.ScriptPubKey.Hash.ScriptPubKey.Equals(scriptPubKey) ||                // as p2sh-p2wpkh
                   (RedeemScript != null && pubkey.WitHash.ScriptPubKey.Equals(RedeemScript)) ||        // as p2sh-p2wpkh or
                   (RedeemScript != null && RedeemScript.GetAllPubKeys().Any(p => p.Equals(pubkey))) || // more paranoia check (Probably unnecessary)
                   (WitnessScript != null && WitnessScript.GetAllPubKeys().Any(p => p.Equals(pubkey))));
        }