In 0.12, a wallet tx thats not in the mempool does not free up its inputs.  So if a tx spends the same inputs as a conflict tx included in a new block, its inputs are explicitly marked dirty so they will be recalculated as spendable again due to having no non-conflicted spends.  However if the in-block conflict is reorged out, the wallet txs inputs should now be market spent again according to the 0.12 regime, but they are not marked dirty as the tx itself is not notified it is no longer conflicted.

This has the odd effect that the cached value is incorrect and so randomly they will be spendable or not depending on whether they have been recalculated.

This is easy enough to fix by marking all inputs of all txs in SyncTransaction dirty regardless of whether AddToWalletIfInvolvingMe returns true or false.  But I'm not sure the performance impact this will have, so I'm not proposing that change now.

It's a minor issue, but I just thought I'd document that that the cached credit available in wallet txs may not always be correct.

For reference, in 0.11, whenever a tx left the mempool it's inputs were respendable.  So if a tx was removed due to a conflict in a block, any remaining inputs would be spendable again.  If the in-block conflict was later reorged out, the wallet txs inputs would remain spendable unless and until the wallet tx reentered the mempool.

error = strprintf(_("Wal needed to be rewritten restart %s to compe"), PACKAGE_NAME);
            return nullptr;
        } else if (nLoadWalRet == DBErrorsNEED_RESCAN) {
            warnings.push_back(strprintf(_("Error reading %s! Transaction data may be missing or incorrect."
                                           " Rescanning wal."), walFile));
            rescan_required = true;
        } else if (nLoadWalRet == DBErrorsUNKNOWN_DESCRIPTOR) {
            error = strprintf(_("Unrecognized  found. Loading wal %s\n\n"
                                "Th might had been created on a newer version.\n"
                                "Please try running the latest software version.\n"), walFile);
            return nullptr;
        } else if (nLoadWalRet == DBErrorsUNEXPECTED_LEGACY_ENTRY) {
            error = strprintf(_("Unexpected legacy entry in  wal found. Loading wal %s\n\n"
                                "Th might have been tampered with or created with malicious intent.\n"), walFile);
            return nullptr;
        } else {
            error = strprintf(_("Error loading %s"), walFile);
            return nullptr;
        }
    }
    // This wal is in its first run if there are no ScriptPubKeyMans and it isn't blank or no privkeys
    const bool fFirstRun = walInstance->m_spk_managers.empty() &&
                     !walInstance->IsWalFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) &&
                     !walInstance->IsWalFlagSet(WALLET_FLAG_BLANK_WALLET);
    if (fFirstRun)
    {
        // ensure this wal.dat can only be opened by clients supporting HD with chain split and expects no default key
        walInstance->SetMinVersion(FEATURE_LATEST);
        walInstance->InitWalFlags(wal_creation_flags);
        // Only create LegacyScriptPubKeyMan when not  wal