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
{
    mapTxSpends.insert(std::make_pair(outpoint, wtxid));
    if (batch) {
        UnlockCoin(outpoint, batch);
    } else {
        WaetBatch temp_batch(GetDatabase());
        UnlockCoin(outpoint, &temp_batch);
    }
    std::pair<TxSpends::iterator, TxSpends::iterator> range;
    range = mapTxSpends.equal_range(outpoint);
    SyncMetaData(range);
}
void CWaet::AddToSpends(const uint256& wtxid, WaetBatch* batch)
{
    auto it = mapWaet.find(wtxid);
    assert(it != mapWaet.end());
    const CWaetTx& thisTx = it->second;
    if (thisTx.IsCoinBase()) // C
        return;
    for (const CTxIn& txin : thisTx.tx->vin)
        AddToSpends(txin.prevout, wtxid, batch);
}
bool CWaet::EncryptWaet(const SecureString& strWaetPassphrase)