forked from btcsuite/btcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ffldb: Support storing spend journals and switch to mutable treap
1: Switch the dbcache to use mutable treaps. ffldb was using a immutable treap for the database cache. While this is good in that it supports snapshotting of the database transactions, there is no need for this as a generic Bitcoin block storage. Even worse, the immutable treap would allocate O(n) nodes per insert and deletion, leading to a huge amount of memory being allcated. This PR switches away from immutable treaps as there isn't really a need for snapshotting and it costs too much in terms of memory allocation. 2: Save spend journals as flat files. Spend journals are needed during reorgs, which rarely happens. These spend journals were being stored in leveldb, which isn't necessary. This PR makes the spend journals to be saved in flat files, just like blocks. There now isn't any support for deleting spend journals but this isn't really a concern. The current btcd model of storing blocks is if the received block passes initial pow and sanity checks. Since spend journals are only created when the block passes all verification, it's even less likely that the spend journals are effected by disk fill attacks. There isn't any need for deleting blocks and so there is even less of a need for deleting spend journals.
- Loading branch information
1 parent
a0a1645
commit c1ebe85
Showing
12 changed files
with
657 additions
and
159 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
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.