diff --git a/programs/beekeeper/core/wallet_manager_impl.cpp b/programs/beekeeper/core/wallet_manager_impl.cpp index a9c6c64556..a40bb458fc 100644 --- a/programs/beekeeper/core/wallet_manager_impl.cpp +++ b/programs/beekeeper/core/wallet_manager_impl.cpp @@ -141,7 +141,7 @@ std::vector< std::string > wallet_manager_impl::list_created_wallets_impl( const if( !_path_parts.empty() ) { auto _end = *_path_parts.rbegin(); - auto _found = _end.find( extension ); + auto _found = _end.rfind( extension ); if( _found != std::string::npos ) _result.emplace_back( _end.substr( 0, _found ) ); } diff --git a/tests/unit/tests/beekeeper_tests.cpp b/tests/unit/tests/beekeeper_tests.cpp index e470a3b8e8..6f5d696c59 100644 --- a/tests/unit/tests/beekeeper_tests.cpp +++ b/tests/unit/tests/beekeeper_tests.cpp @@ -115,7 +115,6 @@ BOOST_AUTO_TEST_CASE(wallet_test) } FC_LOG_AND_RETHROW() } - BOOST_AUTO_TEST_CASE(wallet_name_test) { try { test_utils::beekeeper_mgr b_mgr; @@ -150,6 +149,34 @@ BOOST_AUTO_TEST_CASE(wallet_name_test) } FC_LOG_AND_RETHROW() } +BOOST_AUTO_TEST_CASE(wallet_complex_name_test) +{ try { + test_utils::beekeeper_mgr b_mgr; + b_mgr.remove_wallets(); + + appbase::application app; + + beekeeper_wallet_manager wm = b_mgr.create_wallet( app, 900, 3 ); + + BOOST_REQUIRE( wm.start() ); + std::string _token = wm.create_session( "this is salt", std::optional() ); + + std::string _wallet_name = "small.minion.wallet"; + + wm.create( _token, _wallet_name, std::optional() ); + BOOST_REQUIRE_EQUAL( wm.list_created_wallets( _token ).size(), 1 ); + BOOST_REQUIRE_EQUAL( wm.list_wallets( _token ).size(), 1 ); + + wm.lock( _token, _wallet_name ); + BOOST_REQUIRE_EQUAL( wm.list_created_wallets( _token ).size(), 1 ); + BOOST_REQUIRE_EQUAL( wm.list_wallets( _token ).size(), 1 ); + + wm.open( _token, _wallet_name ); + BOOST_REQUIRE_EQUAL( wm.list_created_wallets( _token ).size(), 1 ); + BOOST_REQUIRE_EQUAL( wm.list_wallets( _token ).size(), 1 ); + +} FC_LOG_AND_RETHROW() } + /// Test wallet manager BOOST_AUTO_TEST_CASE(wallet_manager_test) { try {