transaction_builder& transaction_builder::update_signing_key( const string& authorizing_account_name, const string& delegate_name, const public_key_type& signing_key ) { try { const owallet_account_record authorizing_account_record = _wimpl->_wallet_db.lookup_account( authorizing_account_name ); if( !authorizing_account_record.valid() ) FC_THROW_EXCEPTION( unknown_account, "Unknown authorizing account name!" ); const oaccount_record delegate_record = _wimpl->_blockchain->get_account_record( delegate_name ); if( !delegate_record.valid() ) FC_THROW_EXCEPTION( unknown_account, "Unknown delegate account name!" ); trx.update_signing_key( delegate_record->id, signing_key ); deduct_balance( authorizing_account_record->owner_address(), asset() ); ledger_entry entry; entry.from_account = authorizing_account_record->active_key(); entry.to_account = delegate_record->owner_key; entry.memo = "update block signing key"; transaction_record.ledger_entries.push_back( entry ); required_signatures.insert( authorizing_account_record->active_key() ); return *this; } FC_CAPTURE_AND_RETHROW( (authorizing_account_name)(delegate_name)(signing_key) ) }
void wallet_db::remove_contact_account( const string& account_name ) { const owallet_account_record account_record = lookup_account( account_name ); FC_ASSERT( account_record.valid() ); FC_ASSERT( !account_record->is_my_account ); const int32_t& record_index = account_record->wallet_record_index; accounts.erase( record_index ); address_to_account_wallet_record_index.erase( address( account_record->owner_key ) ); for( const auto& item : account_record->active_key_history ) { const public_key_type& active_key = item.second; address_to_account_wallet_record_index.erase( address( active_key ) ); } if( account_record->is_delegate() ) { for( const auto& item : account_record->delegate_info->signing_key_history ) { const public_key_type& signing_key = item.second; address_to_account_wallet_record_index.erase( address( signing_key ) ); } } name_to_account_wallet_record_index.erase( account_record->name ); account_id_to_wallet_record_index.erase( account_record->id ); // TODO: Remove key records and indexes }