Giter Site home page Giter Site logo

Comments (8)

dimxy avatar dimxy commented on August 14, 2024 1

is it okay to fail reading this file once? If yes we may just set nVersionRequired to 70100 on writing and instruct users to ignore the error one time at startup

from komodo.

jmjatlanta avatar jmjatlanta commented on August 14, 2024

The logic within ReadFeeEstimates seems to be there to protect the code from reading "older" versions. And to the code, a lower number is an older version.

Changing nVersionRequired in ReadFeeEstimates disables the "version protection" feature of the function, so I imagine that is not what you were suggesting.

Changing nVersionRequired in WriteFeeEstimates would fix this issue for new clients, but would not solve the problem for clients that had the previous version. The error would still appear. In addition, the "version protection" would not work as intended for versions between 70100 and 109900. I do not know the history of those version numbers, so am unsure if that is a real problem or not (I am guessing not).

Other possible options:

  1. Fix CLIENT_VERSION to something above 109900 (logical)
  2. Add logic that specifically looks for 109900 and "does the right thing" (yuck)
  3. change nVersionRequired as you suggested and deal with the error message, making sure each run of komodod writes the file so that the error only appears once, only after the "upgrade". (the lazy but tolerable fix)

Update: I have verified that the fee estimate file is written on komodod shutdown, so with option 3, the error will only appear once if komodod shuts down properly.

Sample test: https://github.com/KomodoPlatform/komodo/compare/dev...jmjatlanta:jmj_issue_523?expand=1

from komodo.

dimxy avatar dimxy commented on August 14, 2024

I agree that much better is to provide compatibility with the files written with the 109900 value
maybe we could make a special case for it:
from now on write with nVersionRequired == 70100
but allow also to read old files with 109900:

        filein >> nVersionRequired >> nVersionThatWrote;
        if (nVersionRequired > CLIENT_VERSION && nVersionRequired != 109900 /*allow old files*/)
            return error("CTxMemPool::ReadFeeEstimates(): up-version (%d) fee estimate file", nVersionRequired);

assuming the format has never changed in our codebase. So we establish protection for future versions

from komodo.

DeckerSU avatar DeckerSU commented on August 14, 2024

My offer is to change version required to read in WriteFeeEstimates to 70100, like:

bool
CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
{
    try {
        LOCK(cs);
        fileout << 70100; // version required to read: 0.7.1.0 or later

And users with existing fee_estimates.dat who will have the:

ERROR: CTxMemPool::ReadFeeEstimates(): up-version (109900) fee estimate file

should just delete the file and let the app re-create it.

from komodo.

dimxy avatar dimxy commented on August 14, 2024

Even no need to delete the file. The error would show once on the first startup and the file will be overwritten on next write.
But maybe we need to provide that the error won't show itself and the file is read okay even at the first run ?

from komodo.

DeckerSU avatar DeckerSU commented on August 14, 2024

Maybe. But i just don't like "special cases". What if we will add 109900 as an exception, but in future the format of this file will be changed and this exception will cause unforeseen consequences? I always vote for clean logic without "special cases" and "workaround of workarounds". Value of 109900 obviously was a mistake / oversight during version changing, so, i vote for totally get get rid of it, instead of turn it into exception.

from komodo.

jmjatlanta avatar jmjatlanta commented on August 14, 2024

Even no need to delete the file. The error would show once on the first startup and the file will be overwritten on next write. But maybe we need to provide that the error won't show itself and the file is read okay even at the first run ?

What about changing ERROR: to Warning: and perhaps changing the verbiage to denote that processing will continue (as does a nearby message)?

from komodo.

dimxy avatar dimxy commented on August 14, 2024

Maybe let's add a small PR with a fix like this DeckerSU/KomodoOcean@eccb8f7 to close this issue too

from komodo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.