who-biz / qwerty-lmdb

LMDB for qwertycoin
Other
2 stars 2 forks source link

Summary of Progress & Discussion #3

Closed who-biz closed 4 years ago

who-biz commented 5 years ago

Current Progress

In its current state, as of commit https://github.com/who-biz/qwerty-lmdb/commit/870c1af09a42e5edb46a09b18cf55fe013934dd1, this repository builds and will begin syncing if the daemon is launched with: ./src/qwertycoind --db-type=lmdb --log-level=4. Sync progesses until block 391 is encountered. Something causes an error there, and sync can't progress. Still diagnosing where this is coming from.

I also run into the following error, just prior: Block 2e12949a30e9c7991031a4d506f7bd883c56876c0a2b2bee97c80c6a272c6efa already exists in database.

See this commit for the full error message: https://github.com/who-biz/qwerty-lmdb/commit/c5ab41ffbc49bdb90e7b4e2f43d589df04acb316

Implementation, So Far

Structure

who-biz commented 5 years ago

This branch can be compiled to load the blockchain.bin format: https://github.com/who-biz/qwerty-lmdb/tree/blockchain.bin. This format will sync properly, in the current state.

The default branch will compile for LMDB. You'll notice the only difference between these two branches are the function body to Tools::getDefaultDbType().

The LMDB branch still needs fixed with the transaction calls. It looks like the transaction pool, and transaction-related functions in LMDB need added in some more spots. But if you check out the commit history from today, you'll notice that I've begun filling these in. For the time being, I've disabled batch syncing completely on the LMDB branch, while I work out the transaction/key image issues.

who-biz commented 5 years ago

Issue with the key images and transactions appears to be within the Tx pool and moving those transactions into the DB with populated txpool_tx_meta_t struct. That will take a little bit of work, but at least block addition to the DB is working properly, and the blockchain.bin format can still be used as well (something @Xecute0101 mentioned that he definitely wanted to maintain).

who-biz commented 4 years ago

Update Oct 8th, 2019:

As of commit https://github.com/who-biz/qwerty-lmdb/commit/165689a0e17bab722ec4828d53d8829fef588826, sync is tested and confirmed to move past block 391, when using the DB. The database no longer needs the blockchaincache.bin file, when syncing as of this commit: https://github.com/who-biz/qwerty-lmdb/commit/7c2e5e641bec63ac287b74d1c35d2f430690ed4e. This only works properly on first-run, so the data directory needs emptied prior to running in the LMDB format. A second run will load the DB correctly, but as of yet is unable to move past the initial loading. Additionally, sync is somewhat slow, but both of these issues will be ironed out once transactions are working.

As I initially mentioned above, I've now confirmed the issue with key images is occurring in the mempool. Transactions are not being added to the database, due to the transaction pool code still needing updated to accomodate for LMDB. However, all of these functions exist already on the LMDB side, and in Blockchain.cpp, so it is just a matter of adding some conditionals to the functions' in TransactionPool.cpp, and to a lesser extent, Core.cpp.

So, work left to do goes something like this (in order of priority): 1 - Transaction Pool additions 2 - Speed up slow syncing behavior 3 - Fix sync for blockchain.bin format

Outside of the transaction issue, it appears all block-related DB functions are working properly. Somewhere, I messed up the ability to sync in blockchain.bin format, so I'll need to fix that once I'm done working on the database-specific stuff.

who-biz commented 4 years ago

Closing. Will open an issue with updated information.