Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
8f8f6a37
Unverified
Commit
8f8f6a37
authored
Sep 10, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
parent
23e5ad22
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
LevelDB.cpp
LevelDB.cpp
+5
-4
sgxwallet_common.h
sgxwallet_common.h
+2
-0
No files found.
LevelDB.cpp
View file @
8f8f6a37
...
@@ -29,7 +29,8 @@
...
@@ -29,7 +29,8 @@
#include "leveldb/db.h"
#include "leveldb/db.h"
#include "sgxwallet_common.h"
#include "RPCException.h"
#include "LevelDB.h"
#include "LevelDB.h"
using
namespace
leveldb
;
using
namespace
leveldb
;
...
@@ -48,7 +49,7 @@ std::shared_ptr<std::string> LevelDB::readString(const std::string &_key) {
...
@@ -48,7 +49,7 @@ std::shared_ptr<std::string> LevelDB::readString(const std::string &_key) {
auto
result
=
std
::
make_shared
<
std
::
string
>
();
auto
result
=
std
::
make_shared
<
std
::
string
>
();
if
(
db
==
nullptr
)
{
if
(
db
==
nullptr
)
{
throw
std
::
runtime_error
(
"Null db"
);
throw
RPCException
(
NULL_DATABASE
,
"Null db"
);
}
}
auto
status
=
db
->
Get
(
readOptions
,
_key
,
&*
result
);
auto
status
=
db
->
Get
(
readOptions
,
_key
,
&*
result
);
...
@@ -94,9 +95,9 @@ void LevelDB::writeByteArray(std::string &_key, const char *value,
...
@@ -94,9 +95,9 @@ void LevelDB::writeByteArray(std::string &_key, const char *value,
void
LevelDB
::
throwExceptionOnError
(
Status
_status
)
{
void
LevelDB
::
throwExceptionOnError
(
Status
_status
)
{
if
(
_status
.
IsNotFound
())
if
(
_status
.
IsNotFound
())
return
;
return
;
git
if
(
!
_status
.
ok
())
{
if
(
!
_status
.
ok
())
{
throw
std
::
runtime_error
(
"Could not write to database:"
+
_status
.
ToString
());
throw
RPCException
(
COULD_NOT_ACCESS_DATABASE
,
(
"Could not access database database:"
+
_status
.
ToString
()).
c_str
());
}
}
}
}
...
...
sgxwallet_common.h
View file @
8f8f6a37
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#define SEAL_KEY_FAILED -7
#define SEAL_KEY_FAILED -7
#define KEY_SHARE_DOES_NOT_EXIST -7
#define KEY_SHARE_DOES_NOT_EXIST -7
#define KEY_SHARE_ALREADY_EXISTS -8
#define KEY_SHARE_ALREADY_EXISTS -8
#define COULD_NOT_ACCESS_DATABASE -9
#define NULL_DATABASE -10
#define WALLETDB_NAME "sgxwallet.db"
#define WALLETDB_NAME "sgxwallet.db"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment