Fix memo field encryption
This commit is contained in:
parent
8fbe85babb
commit
857a22b237
1 changed files with 5 additions and 1 deletions
|
|
@ -30,7 +30,10 @@ namespace graphene { namespace chain {
|
||||||
void memo_data::set_message(const fc::ecc::private_key& priv, const fc::ecc::public_key& pub,
|
void memo_data::set_message(const fc::ecc::private_key& priv, const fc::ecc::public_key& pub,
|
||||||
const string& msg, uint64_t custom_nonce)
|
const string& msg, uint64_t custom_nonce)
|
||||||
{
|
{
|
||||||
if( priv != fc::ecc::private_key() && pub.valid() )
|
bool should_encrypt = (priv != fc::ecc::private_key() && pub.valid());
|
||||||
|
should_encrypt = (should_encrypt) && (msg.size()) && (msg.find("#") == 0);
|
||||||
|
|
||||||
|
if( should_encrypt )
|
||||||
{
|
{
|
||||||
from = priv.get_public_key();
|
from = priv.get_public_key();
|
||||||
to = pub;
|
to = pub;
|
||||||
|
|
@ -49,6 +52,7 @@ void memo_data::set_message(const fc::ecc::private_key& priv, const fc::ecc::pub
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
to = public_key_type();
|
||||||
auto text = memo_message(0, msg).serialize();
|
auto text = memo_message(0, msg).serialize();
|
||||||
message = vector<char>(text.begin(), text.end());
|
message = vector<char>(text.begin(), text.end());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue