Skip to content
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

Wallet API: add support for wallet creation from hardware device #3921

Merged
merged 3 commits into from
Jun 25, 2018

Conversation

stoffu
Copy link
Contributor

@stoffu stoffu commented Jun 4, 2018

CC: @cslashm

Copy link
Contributor

@cslashm cslashm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keeping an indirection for parse_subaddress_lookahead ?

@stoffu
Copy link
Contributor Author

stoffu commented Jun 4, 2018

@cslashm
Because I wanted simplewallet to print the error message when the parsing fails. Error reporting is not included in tools:: parse_subaddress_lookahead, and the wallet API silently falls back to the default value when the parsing fails.

auto lookahead = tools::parse_subaddress_lookahead(subaddressLookahead);
if (!lookahead)
{
lookahead = tools::parse_subaddress_lookahead("5:20");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe std::make_pair(5,20) ?

{
lookahead = tools::parse_subaddress_lookahead("5:20");
}
wallet->setSubaddressLookahead(lookahead->first, lookahead->second);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though with this, i'll override the wallet2 settings even when not specified. The defaults should be in wallet2 so other programs benefit from a good value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, please see the first commit.

@@ -3269,6 +3269,12 @@ void wallet2::restore(const std::string& wallet_, const epee::wipeable_string& p
cryptonote::block b;
generate_genesis(b);
m_blockchain.push_back(get_block_hash(b));
if (m_subaddress_lookahead_major == SUBADDRESS_LOOKAHEAD_MAJOR && m_subaddress_lookahead_major == SUBADDRESS_LOOKAHEAD_MINOR)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second major should be minor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch :P

@stoffu stoffu force-pushed the ledger-api branch 2 times, most recently from fb1105d to 2253b0f Compare June 4, 2018 11:44
@luigi1111
Copy link
Collaborator

@stoffu please rebase.

@stoffu
Copy link
Contributor Author

stoffu commented Jun 21, 2018

Rebased

@luigi1111 luigi1111 merged commit 46e90b7 into monero-project:master Jun 25, 2018
luigi1111 added a commit that referenced this pull request Jun 25, 2018
8fc0cdb wallet2: lower default for subaddress lookahead when restoring with hardware (stoffu)
248310d Move parse_subaddress_lookahead() from simplewallet.cpp to util.cpp (stoffu)
46e90b7 Wallet API: add support for wallet creation from hardware device (stoffu)
@stoffu stoffu mentioned this pull request Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants