Skip to content

Commit

Permalink
Fix undefined symbol linker error by moving sign and secureHash t…
Browse files Browse the repository at this point in the history
…emplates to .h file (#4084)
  • Loading branch information
ahaladok authored Oct 31, 2024
1 parent 58fdabf commit 63ef219
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
8 changes: 0 additions & 8 deletions src/Harmony/Signer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,6 @@ CollectRewards Signer::buildUnsignedCollectRewards(const Proto::SigningInput &in
return CollectRewards(delegatorAddr);
}

template <typename T>
void Signer::sign(const PrivateKey& privateKey, const Data& hash, T& transaction) const noexcept {
auto tuple = sign(chainID, privateKey, hash);
transaction.r = std::get<0>(tuple);
transaction.s = std::get<1>(tuple);
transaction.v = std::get<2>(tuple);
}

Data Signer::rlpNoHash(const Transaction& transaction, const bool include_vrs) const noexcept {
auto nonce = store(transaction.nonce);
auto gasPrice = store(transaction.gasPrice);
Expand Down
7 changes: 6 additions & 1 deletion src/Harmony/Signer.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ class Signer {

/// Signs the given transaction.
template <typename T>
void sign(const PrivateKey &privateKey, const Data &hash, T &transaction) const noexcept;
void sign(const PrivateKey &privateKey, const Data &hash, T &transaction) noexcept {
auto tuple = sign(chainID, privateKey, hash);
transaction.r = std::get<0>(tuple);
transaction.s = std::get<1>(tuple);
transaction.v = std::get<2>(tuple);
}

/// Signs a hash with the given private key for the given chain identifier.
///
Expand Down
5 changes: 0 additions & 5 deletions src/Waves/Address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@

namespace TW::Waves {

template <typename T>
Data Address::secureHash(const T &data) {
return Hash::keccak256(Hash::blake2b(data, 32));
}

bool Address::isValid(const Data& decoded) {
if (decoded.size() != Address::size) {
return false;
Expand Down
4 changes: 3 additions & 1 deletion src/Waves/Address.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Address : public Base58Address<26> {
static const signed char testnet = 'T';

template <typename T>
static Data secureHash(const T &data);
static Data secureHash(const T &data) {
return Hash::keccak256(Hash::blake2b(data, 32));
}

/// Determines whether a string makes a valid address.
static bool isValid(const std::string& string);
Expand Down

0 comments on commit 63ef219

Please sign in to comment.