Skip to content

Commit

Permalink
IS-864 Small code rearrangement
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalit committed May 10, 2024
1 parent df125fe commit ec40d75
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions libethereum/ChainParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,15 @@ void ChainParams::processSkaleConfigItems( ChainParams& cp, json_spirit::mObject
array< string, 4 > BLSPublicKeys;
array< string, 4 > commonBLSPublicKeys;

if ( !syncNode )
try {
js::mObject ima = infoObj.at( "wallets" ).get_obj().at( "ima" ).get_obj();
try {
js::mObject ima = infoObj.at( "wallets" ).get_obj().at( "ima" ).get_obj();

commonBLSPublicKeys[0] = ima["commonBLSPublicKey0"].get_str();
commonBLSPublicKeys[1] = ima["commonBLSPublicKey1"].get_str();
commonBLSPublicKeys[2] = ima["commonBLSPublicKey2"].get_str();
commonBLSPublicKeys[3] = ima["commonBLSPublicKey3"].get_str();

if ( !syncNode ) {
keyShareName = ima.at( "keyShareName" ).get_str();

t = ima.at( "t" ).get_int();
Expand All @@ -238,26 +243,13 @@ void ChainParams::processSkaleConfigItems( ChainParams& cp, json_spirit::mObject
BLSPublicKeys[1] = ima["BLSPublicKey1"].get_str();
BLSPublicKeys[2] = ima["BLSPublicKey2"].get_str();
BLSPublicKeys[3] = ima["BLSPublicKey3"].get_str();

commonBLSPublicKeys[0] = ima["commonBLSPublicKey0"].get_str();
commonBLSPublicKeys[1] = ima["commonBLSPublicKey1"].get_str();
commonBLSPublicKeys[2] = ima["commonBLSPublicKey2"].get_str();
commonBLSPublicKeys[3] = ima["commonBLSPublicKey3"].get_str();
} catch ( ... ) {
// all or nothing
if ( !keyShareName.empty() )
throw;
}
else
try {
js::mObject ima = infoObj.at( "wallets" ).get_obj().at( "ima" ).get_obj();

commonBLSPublicKeys[0] = ima["commonBLSPublicKey0"].get_str();
commonBLSPublicKeys[1] = ima["commonBLSPublicKey1"].get_str();
commonBLSPublicKeys[2] = ima["commonBLSPublicKey2"].get_str();
commonBLSPublicKeys[3] = ima["commonBLSPublicKey3"].get_str();
} catch ( ... ) {
}
} catch ( ... ) {
// all or nothing
if ( !syncNode && !keyShareName.empty() )
throw;
}

cp.nodeInfo = { nodeName, nodeID, ip, static_cast< uint16_t >( port ), ip6,
static_cast< uint16_t >( port6 ), sgxServerUrl, ecdsaKeyName, keyShareName, BLSPublicKeys,
Expand Down

0 comments on commit ec40d75

Please sign in to comment.