oxen-io / oxen-core

Oxen core repository, containing oxend and oxen cli wallets
https://oxen.io
Other
317 stars 120 forks source link

Version clear out to 0 meant serialized version is always reset after… #1724

Closed Doy-lee closed 2 months ago

Doy-lee commented 2 months ago

… it is updated

In service_node_list::store we have a small loop that resets the data_for_serialization

    for (data_for_serialization* serialize_entry : data) {
        if (serialize_entry->version != serialize_version)
            m_transient.state_added_to_archive = true;
        serialize_entry->version = serialize_version;
        serialize_entry->clear();
    }

Which calls clear after serialize_entry->version = serialize_version. The clear resets the version back to 0 causing the SNL in stagenet to rescan every time because the version nevers ends up being saved as v1.

I've moved the version assignment to after the clear to fix that.