-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blockchain: Remove compression version param.
Over the years it has become increasingly obvious that storing multiple versioned formats in the database in an attempt to avoid migrations leads to code that is super hard to reason about and for which it is also difficult to assert correctness. This is the case because it results in a combinatorial explosion of cases that must be handled. For example, as soon as you have 3 versions, you're already up to 8 variants you have to handle properly and test, and it only gets exponentially worse with each new version. Due to this, it is greatly preferred to perform a single migration that handles the conversion logic once. This allows the rest of the code, especially in the critical paths, to work solely with the latest version and therefore stays much cleaner, easier to validate for correctness, and is generally easier to reason about. With that in mind, this removes the compression version parameter from the functions that deal with serializing and deserializing compressed scripts. Since there is only a currently a single version it does not require any migrations. However, since the existing migration code for older versions was passing in the old version parameter, new v1 functions have been added to the upgrade code to ensure stability there.
- Loading branch information
Showing
5 changed files
with
195 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.