mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Updating the self pubkey in the unl list when rekey the contract. (#259)
PR approved
This commit is contained in:
committed by
GitHub
parent
1cebcb1c35
commit
1ca4784688
14
src/conf.cpp
14
src/conf.cpp
@@ -84,10 +84,24 @@ namespace conf
|
||||
if (read_config(cfg) != 0)
|
||||
return -1;
|
||||
|
||||
// Old public key in binary format.
|
||||
const std::string old_pub_key_bin = cfg.node.public_key;
|
||||
|
||||
crypto::generate_signing_keys(cfg.node.public_key, cfg.node.private_key);
|
||||
cfg.node.public_key_hex = util::to_hex(cfg.node.public_key);
|
||||
cfg.node.private_key_hex = util::to_hex(cfg.node.private_key);
|
||||
|
||||
// Extract old pubkey from unl and re-insert the new public key in to the unl list.
|
||||
auto extracted_public_key_node = cfg.contract.unl.extract(old_pub_key_bin);
|
||||
if (extracted_public_key_node.empty())
|
||||
{
|
||||
std::cerr << "Updating public key in unl list failed.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
extracted_public_key_node.value() = cfg.node.public_key;
|
||||
cfg.contract.unl.insert(std::move(extracted_public_key_node));
|
||||
|
||||
if (write_config(cfg) != 0)
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user