Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d1e2ab3ce |
2 changed files with 2 additions and 43 deletions
|
|
@ -188,7 +188,6 @@ struct wallet_data
|
||||||
// incomplete account regs
|
// incomplete account regs
|
||||||
map<string, vector<string> > pending_account_registrations;
|
map<string, vector<string> > pending_account_registrations;
|
||||||
map<string, string> pending_witness_registrations;
|
map<string, string> pending_witness_registrations;
|
||||||
map<string, string> pending_son_registrations;
|
|
||||||
|
|
||||||
key_label_index_type labeled_keys;
|
key_label_index_type labeled_keys;
|
||||||
blind_receipt_index_type blind_receipts;
|
blind_receipt_index_type blind_receipts;
|
||||||
|
|
@ -1999,7 +1998,7 @@ FC_REFLECT( graphene::wallet::wallet_data,
|
||||||
(my_accounts)
|
(my_accounts)
|
||||||
(cipher_keys)
|
(cipher_keys)
|
||||||
(extra_keys)
|
(extra_keys)
|
||||||
(pending_account_registrations)(pending_witness_registrations)(pending_son_registrations)
|
(pending_account_registrations)(pending_witness_registrations)
|
||||||
(labeled_keys)
|
(labeled_keys)
|
||||||
(blind_receipts)
|
(blind_receipts)
|
||||||
(committed_game_moves)
|
(committed_game_moves)
|
||||||
|
|
|
||||||
|
|
@ -293,23 +293,6 @@ private:
|
||||||
_wallet.pending_account_registrations.erase( it );
|
_wallet.pending_account_registrations.erase( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
// after a son registration succeeds, this saves the private key in the wallet permanently
|
|
||||||
//
|
|
||||||
void claim_registered_son(const std::string& son_name)
|
|
||||||
{
|
|
||||||
auto iter = _wallet.pending_son_registrations.find(son_name);
|
|
||||||
FC_ASSERT(iter != _wallet.pending_son_registrations.end());
|
|
||||||
std::string wif_key = iter->second;
|
|
||||||
|
|
||||||
// get the list key id this key is registered with in the chain
|
|
||||||
fc::optional<fc::ecc::private_key> son_private_key = wif_to_key(wif_key);
|
|
||||||
FC_ASSERT(son_private_key);
|
|
||||||
|
|
||||||
auto pub_key = son_private_key->get_public_key();
|
|
||||||
_keys[pub_key] = wif_key;
|
|
||||||
_wallet.pending_son_registrations.erase(iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// after a witness registration succeeds, this saves the private key in the wallet permanently
|
// after a witness registration succeeds, this saves the private key in the wallet permanently
|
||||||
//
|
//
|
||||||
void claim_registered_witness(const std::string& witness_name)
|
void claim_registered_witness(const std::string& witness_name)
|
||||||
|
|
@ -371,24 +354,6 @@ private:
|
||||||
claim_registered_witness(optional_account->name);
|
claim_registered_witness(optional_account->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_wallet.pending_son_registrations.empty())
|
|
||||||
{
|
|
||||||
// make a vector of the owner accounts for sons pending registration
|
|
||||||
std::vector<string> pending_son_names = boost::copy_range<std::vector<string> >(boost::adaptors::keys(_wallet.pending_son_registrations));
|
|
||||||
|
|
||||||
// look up the owners on the blockchain
|
|
||||||
std::vector<fc::optional<graphene::chain::account_object>> owner_account_objects = _remote_db->lookup_account_names(pending_son_names);
|
|
||||||
|
|
||||||
// if any of them have registered sons, claim them
|
|
||||||
for( const fc::optional<graphene::chain::account_object>& optional_account : owner_account_objects )
|
|
||||||
if (optional_account)
|
|
||||||
{
|
|
||||||
fc::optional<son_object> son_obj = _remote_db->get_son_by_account(optional_account->id);
|
|
||||||
if (son_obj)
|
|
||||||
claim_registered_son(optional_account->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if any of my_accounts are players in this tournament
|
// return true if any of my_accounts are players in this tournament
|
||||||
|
|
@ -1865,10 +1830,7 @@ public:
|
||||||
bool broadcast /* = false */)
|
bool broadcast /* = false */)
|
||||||
{ try {
|
{ try {
|
||||||
account_object son_account = get_account(owner_account);
|
account_object son_account = get_account(owner_account);
|
||||||
fc::ecc::private_key active_private_key = get_private_key_for_account(son_account);
|
auto son_public_key = son_account.active.get_keys()[0];
|
||||||
int son_key_index = find_first_unused_derived_key_index(active_private_key);
|
|
||||||
fc::ecc::private_key son_private_key = derive_private_key(key_to_wif(active_private_key), son_key_index);
|
|
||||||
graphene::chain::public_key_type son_public_key = son_private_key.get_public_key();
|
|
||||||
|
|
||||||
son_create_operation son_create_op;
|
son_create_operation son_create_op;
|
||||||
son_create_op.owner_account = son_account.id;
|
son_create_op.owner_account = son_account.id;
|
||||||
|
|
@ -1885,8 +1847,6 @@ public:
|
||||||
set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees);
|
set_operation_fees( tx, _remote_db->get_global_properties().parameters.current_fees);
|
||||||
tx.validate();
|
tx.validate();
|
||||||
|
|
||||||
_wallet.pending_son_registrations[owner_account] = key_to_wif(son_private_key);
|
|
||||||
|
|
||||||
return sign_transaction( tx, broadcast );
|
return sign_transaction( tx, broadcast );
|
||||||
} FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
|
} FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue