This would allow wallet operations like funding transactions with smart contract-based inputs such as LN, or any input the Core wallet doesn't know how to sign for.

https://github.com/bitcoin/bitcoin/pull/17211#issuecomment-933674310
}
        bool fExisted = mapWaet.count(tx.GetHash()) != 0;
        if (fExisted && !fUpdate) return false;
        if (fExisted || IsMine(tx) || IsFromMe(tx))
        {
            /* Check if any keys in the  keypool that were supposed to be unused
             * have appeared in a new transaction.  so, remove those keys from the keypool.
             * This can happen when restoring an old  backup that does not contain
             * the mostly recently created transactions from newer versions of the .
             */
            // l
            for (const CTxOut& txout: tx.vout) {
                for (const auto& spk_man : GetScriptPubKeyMans(txout.scriptPubKey)) {
                    for (auto &dest : spk_man->MarkUnusedAddresses(txout.scriptPubKey)) {
                        // I
                        if (!dest.internal.has_value()) {
                            dest.internal = IsInternalScriptPubKeyMan(spk_man);
                        }
                        // s
                        if (!dest.internal.has_value()) continue;
                        // I
                        // (
                        // a
                        if (!*dest.internal && !FindAddressBookEntry(dest.dest, /* ase)) {
                            SetAddressBook(dest.dest, "", "receive");
                        }
                    }
                }
            }
            // B