diff --git a/libraries/chain/db_management.cpp b/libraries/chain/db_management.cpp index cbf7f018..2ca49c4c 100644 --- a/libraries/chain/db_management.cpp +++ b/libraries/chain/db_management.cpp @@ -123,7 +123,7 @@ void database::reindex( fc::path data_dir ) } for( uint32_t i = head_block_num() + 1; i <= last_block_num; ++i ) { - if( i % 10000 == 0 ) + if( i % 1000000 == 0 ) { ilog( "Writing database to disk at block ${i}", ("i",i) ); flush(); diff --git a/libraries/db/include/graphene/db/undo_database.hpp b/libraries/db/include/graphene/db/undo_database.hpp index 4b727372..0eb00f55 100644 --- a/libraries/db/include/graphene/db/undo_database.hpp +++ b/libraries/db/include/graphene/db/undo_database.hpp @@ -34,10 +34,10 @@ namespace graphene { namespace db { struct undo_state { - unordered_map > old_values; - unordered_map old_index_next_ids; - std::unordered_set new_ids; - unordered_map > removed; + unordered_map > old_values; + unordered_map old_index_next_ids; + std::set > new_ids; + unordered_map > removed; }; diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 8edfbd65..ae8b350e 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2202,11 +2202,8 @@ public: vector owners; for(auto obj: son_objects) { - if (obj) - { - std::string acc_id = account_id_to_string(obj->son_account); - owners.push_back(acc_id); - } + std::string acc_id = account_id_to_string(obj->son_account); + owners.push_back(acc_id); } vector< optional< account_object> > accs = _remote_db->get_accounts(owners); std::remove_if(son_objects.begin(), son_objects.end(), @@ -2216,9 +2213,7 @@ public: std::inserter(result, result.end()), [](fc::optional& acct, fc::optional son) { FC_ASSERT(acct, "Invalid active SONs list in global properties."); - if (son.valid() && son->status != son_status::deregistered) - return std::make_pair(string(acct->name), std::move(son->id)); - return std::make_pair(string(acct->name), std::move(son_id_type())); + return std::make_pair(string(acct->name), std::move(son->id)); }); return result; } FC_CAPTURE_AND_RETHROW() } @@ -4184,27 +4179,33 @@ string operation_printer::operator()(const transfer_operation& op) const std::string memo; if( op.memo ) { - if( wallet.is_locked() ) - { - out << " -- Unlock wallet to see memo."; - } else { - try { - FC_ASSERT(wallet._keys.count(op.memo->to) || wallet._keys.count(op.memo->from), "Memo is encrypted to a key ${to} or ${from} not in this wallet.", ("to", op.memo->to)("from",op.memo->from)); - if( wallet._keys.count(op.memo->to) ) { - auto my_key = wif_to_key(wallet._keys.at(op.memo->to)); - FC_ASSERT(my_key, "Unable to recover private key to decrypt memo. Wallet may be corrupted."); - memo = op.memo->get_message(*my_key, op.memo->from); - out << " -- Memo: " << memo; - } else { - auto my_key = wif_to_key(wallet._keys.at(op.memo->from)); - FC_ASSERT(my_key, "Unable to recover private key to decrypt memo. Wallet may be corrupted."); - memo = op.memo->get_message(*my_key, op.memo->to); - out << " -- Memo: " << memo; + bool is_encrypted = ((op.memo->from != public_key_type()) && (op.memo->to != public_key_type())); + if (is_encrypted) { + if( wallet.is_locked() ) + { + out << " -- Unlock wallet to see memo."; + } else { + try { + FC_ASSERT(wallet._keys.count(op.memo->to) || wallet._keys.count(op.memo->from), "Memo is encrypted to a key ${to} or ${from} not in this wallet.", ("to", op.memo->to)("from",op.memo->from)); + if( wallet._keys.count(op.memo->to) ) { + auto my_key = wif_to_key(wallet._keys.at(op.memo->to)); + FC_ASSERT(my_key, "Unable to recover private key to decrypt memo. Wallet may be corrupted."); + memo = op.memo->get_message(*my_key, op.memo->from); + out << " -- Memo: " << memo; + } else { + auto my_key = wif_to_key(wallet._keys.at(op.memo->from)); + FC_ASSERT(my_key, "Unable to recover private key to decrypt memo. Wallet may be corrupted."); + memo = op.memo->get_message(*my_key, op.memo->to); + out << " -- Memo: " << memo; + } + } catch (const fc::exception& e) { + out << " -- could not decrypt memo"; + elog("Error when decrypting memo: ${e}", ("e", e.to_detail_string())); } - } catch (const fc::exception& e) { - out << " -- could not decrypt memo"; - elog("Error when decrypting memo: ${e}", ("e", e.to_detail_string())); } + } else { + memo = op.memo->get_message(private_key_type(), public_key_type()); + out << " -- Memo: " << memo; } } fee(op.fee);