Skip to content

Commit

Permalink
Fix invite_secret from string type to shared_string
Browse files Browse the repository at this point in the history
  • Loading branch information
On1x committed Nov 1, 2018
1 parent df5ac18 commit 7a596ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libraries/api/invite_api_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace graphene { namespace api {
creator(o.creator),
receiver(o.receiver),
invite_key(o.invite_key),
invite_secret(o.invite_secret),
invite_secret(to_string(o.invite_secret)),
balance(o.balance),
claimed_balance(o.claimed_balance),
create_time(o.create_time),
Expand Down
5 changes: 3 additions & 2 deletions libraries/chain/include/graphene/chain/invite_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace graphene {
invite_object() = delete;

template<typename Constructor, typename Allocator>
invite_object(Constructor &&c, allocator <Allocator> a) {
invite_object(Constructor &&c, allocator <Allocator> a)
:invite_secret(a) {
c(*this);
}

Expand All @@ -26,7 +27,7 @@ namespace graphene {
account_name_type creator;
account_name_type receiver;
public_key_type invite_key;
string invite_secret;
shared_string invite_secret;

asset balance = asset(0, TOKEN_SYMBOL);
asset claimed_balance = asset(0, TOKEN_SYMBOL);
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/invite_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace graphene { namespace chain {
if(itr->status == 0){
_db.modify(*itr, [&](invite_object& c) {
c.status = 1;
c.invite_secret.append(o.invite_secret.c_str());
from_string(c.invite_secret, o.invite_secret);
c.receiver = o.receiver;
c.claimed_balance=c.balance;
c.balance=asset(0, TOKEN_SYMBOL);
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace graphene { namespace chain {
_db.create_vesting(new_account, itr->balance);
_db.modify(*itr, [&](invite_object& c) {
c.status = 2;
c.invite_secret.append(o.invite_secret.c_str());
from_string(c.invite_secret, o.invite_secret);
c.receiver = o.new_account_name;
c.claimed_balance=c.balance;
c.balance=asset(0, TOKEN_SYMBOL);
Expand Down

0 comments on commit 7a596ef

Please sign in to comment.