-
Notifications
You must be signed in to change notification settings - Fork 59
WIP store utxo set in the database and not in ram 2 #2159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is still unresolved but I think I will just add a check to ensure that there is only one chain state, and panic otherwise. |
99321c3
to
9aaed58
Compare
9aaed58
to
4ba3001
Compare
9e4e0b3
to
4f90bca
Compare
1f4c255
to
75c00e7
Compare
I think we should have a discussion before merge this PR due to be a change without backward compatible in the database |
2926c6d
to
ede5917
Compare
ede5917
to
d5b5311
Compare
d5b5311
to
ca16cdc
Compare
There are some problems when the synchronization process is interrupted, it is possible for the node to become forked and the only way to recover is to use the rewind command. I think it is related to #2102, will keep investigating. |
6134ca1
to
297a4d3
Compare
78662e0
to
fff534e
Compare
feat(node): allow access to db outside StorageManager feat(storage): allow mutable operations using shared references
Add db_iter to UnspentOutputsPool
To ensure that the utxo set is always updated atomically: it should be impossible to leave the database in a state where the utxo set was only halfway updated
This fixes a bug where recently written UTXOs were not detected by the validation code, leading to errors and possible forks.
fff534e
to
6d42a2b
Compare
This is fixed now |
This is also implemented now |
cca29fa
to
28f8084
Compare
node/src/storage_mngr.rs
Outdated
|
||
pub use node_migrations::*; | ||
use witnet_storage::storage::WriteBatch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
storage/src/backends/hashmap.rs
Outdated
@@ -3,38 +3,97 @@ | |||
//! Storage backend that keeps data in a heap-allocated HashMap. | |||
use std::collections::HashMap; | |||
|
|||
use crate::storage::{Result, Storage}; | |||
use crate::storage::{Result, Storage, StorageIterator, WriteBatch, WriteBatchItem}; | |||
use std::sync::{RwLock, RwLockReadGuard}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
This PR stores consolidated entries of the UTXO set in the storage, and the non-consolidated entries in RAM. Consolidated means included in a consolidated superblock.
Close #1275
Warning: this PR makes breaking changes to the storage, so backup before testing.