public void TrySign(IHDScriptPubKey accountHDScriptPubKey, IHDKey accountKey, RootedKeyPath accountKeyPath, SigHash sigHash = SigHash.All) { if (accountKey == null) { throw new ArgumentNullException(nameof(accountKey)); } if (accountHDScriptPubKey == null) { throw new ArgumentNullException(nameof(accountHDScriptPubKey)); } var cache = accountKey.AsHDKeyCache(); accountHDScriptPubKey = accountHDScriptPubKey.AsHDKeyCache(); foreach (var hdk in this.HDKeysFor(accountHDScriptPubKey, cache, accountKeyPath)) { if (((HDKeyCache)cache.Derive(hdk.AddressKeyPath)).Inner is ISecret k) { Sign(k.PrivateKey, sigHash); } else { throw new ArgumentException(paramName: nameof(accountKey), message: "This should be a private key"); } } }
public override void AddKeyPath(PubKey key, RootedKeyPath rootedKeyPath) { base.AddKeyPath(key, rootedKeyPath); TrySlimUTXO(); }