Skip to content

Commit

Permalink
Removing usages of std::format() and #inclusions of <format> as the l…
Browse files Browse the repository at this point in the history
…atter causes compilation errors under OSX in our github CI (old version apparently)
  • Loading branch information
gevorgvoskanyan committed Feb 21, 2025
1 parent 7e854c3 commit 3e9ec27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/spark/state.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <format>

#include <boost/exception/diagnostic_information.hpp>

#include "state.h"
Expand Down Expand Up @@ -883,7 +881,7 @@ bool CheckSparkSpendTransaction(
return state.DoS(100,
false,
REJECT_MALFORMED,
std::format("CheckSparkSpendTransaction: failed to deserialize spats tx: {}", e.what()));
"CheckSparkSpendTransaction: failed to deserialize spats tx: "s + e.what());
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/spats/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Created by Gevorg Voskanyan
//

#include <format>

#include "../validation.h"
#include "../wallet/wallet.h"
#include "../spark/sparkwallet.h"
Expand All @@ -16,7 +14,7 @@ namespace spats {

Scalar Wallet::compute_new_spark_asset_serialization_scalar( const SparkAssetBase &b, std::span< const unsigned char > asset_serialization_bytes )
{
spark::Hash hash( std::format( "spatsnew_{}_from_{}", utils::to_underlying( b.asset_type() ), b.admin_public_address() ) );
spark::Hash hash( tfm::format( "spatsnew_%u_from_%s", utils::to_underlying( b.asset_type() ), b.admin_public_address() ) );
hash.include( asset_serialization_bytes );
auto ret = hash.finalize_scalar();
LogPrintf( "New spark asset serialization scalar (hex): %s\n", ret.GetHex() );
Expand All @@ -27,7 +25,7 @@ Scalar Wallet::compute_unregister_spark_asset_serialization_scalar( const Unregi
{
auto identifier_absense_sentinel = max_allowed_identifier_value;
++identifier_absense_sentinel;
spark::Hash hash( std::format( "spatsunreg_{}_{}_from_{}",
spark::Hash hash( tfm::format( "spatsunreg_%u_%u_from_%s",
utils::to_underlying( p.asset_type() ),
utils::to_underlying( p.identifier().value_or( identifier_absense_sentinel ) ),
p.initiator_public_address() ) );
Expand All @@ -39,7 +37,7 @@ Scalar Wallet::compute_unregister_spark_asset_serialization_scalar( const Unregi

Scalar Wallet::compute_modify_spark_asset_serialization_scalar( const AssetModificationBase &b, std::span< const unsigned char > modification_serialization_bytes )
{
spark::Hash hash( std::format( "spatsmodify_{}_from_{}", utils::to_underlying( b.asset_type() ), b.initiator_public_address() ) );
spark::Hash hash( tfm::format( "spatsmodify_%u_from_%s", utils::to_underlying( b.asset_type() ), b.initiator_public_address() ) );
hash.include( modification_serialization_bytes );
auto ret = hash.finalize_scalar();
LogPrintf( "Modify spark asset serialization scalar (hex): %s\n", ret.GetHex() );
Expand Down

0 comments on commit 3e9ec27

Please sign in to comment.