WIP store utxo set in the database and not in ram 2#2159
WIP store utxo set in the database and not in ram 2#2159tmpolaczyk merged 32 commits intowitnet:masterfrom
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
| use witnet_storage::{backends, storage, storage::Storage}; | ||
|
|
||
| pub use node_migrations::*; | ||
| use witnet_storage::storage::WriteBatch; |
storage/src/backends/hashmap.rs
Outdated
|
|
||
| use crate::storage::{Result, Storage}; | ||
| use crate::storage::{Result, Storage, StorageIterator, WriteBatch, WriteBatchItem}; | ||
| use std::sync::{RwLock, RwLockReadGuard}; |
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.