bitcoinjs / regtest-server

A regtest server for bitcoinjs-lib testing
BSD 3-Clause "New" or "Revised" License
24 stars 24 forks source link

Unspents are not served after mining #23

Open landabaso opened 1 month ago

landabaso commented 1 month ago

The problem was introduced in PR #13 due to the upgrade to leveldown 6.

When requesting UTXOs, if they are still in the mempool, indexd returns values from memory.

However, after mining, indexd uses the leveldown instance passed from regtest-server and the iterator method, which has changed since leveldown 5. Despite my efforts, I have not been able to fix this issue.

The problematic line that does not return values with leveldown > 4 is here. The likely place for a fix is in the dbwrapper.js file (iterator method).

The same code works fine with leveldown 4, but using leveldown 4 requires node 10 for installation so this really needs to be fixed...

@junderw I recommend you don't update the Docker image with the current regtest-server until this is resolved. Many tests won't be affected if mining was not involved, but there is a chance someone will encounter this issue sooner or later.

I will continue to work on this for a bit more, but I am documenting this issue in case I cannot fix it and someone else encounters it in the future.

junderw commented 1 month ago

Thank you!