-
Notifications
You must be signed in to change notification settings - Fork 34
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
Update node initiation to handle Persistent DB #61
Conversation
7cb670b
to
b4b7a91
Compare
@RCasatta tried to fix the test failure.. But now its failing in some other tests.. Not the newly added one.. |
Hi @raj, sorry for not having a look in a timely manner. I see there are multiple issues:
Once ready I will check again. |
747b61a
to
d1aeecf
Compare
Rebased on current master and cleared commit history.. Not really sure how those previous commits got added.. Removed the TEMPDIR_ROOT from CI env.. |
src/lib.rs
Outdated
client_base | ||
.create_wallet("default", None, None, None, None) | ||
.unwrap(); | ||
break Client::new(&node_url_default, Auth::CookieFile(cookie_file.clone())) |
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.
did you consider a more "ask-for-forgiveness" approach? I suspect it would be shorter/cleaner
like matching on client_base.create_wallet("default", None, None, None, None)
and in case of error doing the staticdir case checks
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.
Ah.. I think that makes more sense and I probably took your simplification idea to extreme, 😅 and removed almost all of the code.. But I think the logic still stands and we don't necessarily need to find out the existing wallet file to try to load it up.. And yes its much simpler than what I was trying..
026e3a4
to
00bc944
Compare
Thanks Ricardo for the suggestion.. Updated with the same.. Kept the commit separate for easier review.. Let me know if you need a squash.. |
00bc944 LGTM yes, please squash since commits touch the same code, I will ack and merge |
In case of persistent db, check if the "default" wallet file already exists. Load it if it does. Or else create new wallet. Always create new wallet for temp db. Remove global temp env variable in CI.
00bc944
to
2d5661d
Compare
Done.. |
Thanks! ACK 2d5661d |
In usage of recently added #52 , the expected behaviour for
Persistent
type datadir is, the new instance of core will inherent all the existing data. Which is working as expected for other data (blocks, chainstate etc), except the wallet directory.The current behavior tries to always create a new
default
wallet at initiation. In case of persistent DB that gives rpc error "wallet file already exists".This PR updates the init process to handle persistent type database properly..
A test to check the behavior is also added.