From e1f8f40006d7cab30a3f0c92f53c63bbff2e362e Mon Sep 17 00:00:00 2001 From: ahaladok Date: Tue, 29 Oct 2024 12:21:24 +0100 Subject: [PATCH] Fix undefined symbol linker error by moving `sign` and `secureHash` templates to .h file --- src/Harmony/Signer.cpp | 8 -------- src/Harmony/Signer.h | 7 ++++++- src/Waves/Address.cpp | 5 ----- src/Waves/Address.h | 4 +++- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Harmony/Signer.cpp b/src/Harmony/Signer.cpp index 5870b4769ec..79f59e80f08 100644 --- a/src/Harmony/Signer.cpp +++ b/src/Harmony/Signer.cpp @@ -297,14 +297,6 @@ CollectRewards Signer::buildUnsignedCollectRewards(const Proto::SigningInput &in return CollectRewards(delegatorAddr); } -template -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); diff --git a/src/Harmony/Signer.h b/src/Harmony/Signer.h index 0c8b073a196..5eea695bea4 100644 --- a/src/Harmony/Signer.h +++ b/src/Harmony/Signer.h @@ -60,7 +60,12 @@ class Signer { /// Signs the given transaction. template - 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. /// diff --git a/src/Waves/Address.cpp b/src/Waves/Address.cpp index 9b9ab7a27fa..39eeb09a8c6 100644 --- a/src/Waves/Address.cpp +++ b/src/Waves/Address.cpp @@ -15,11 +15,6 @@ namespace TW::Waves { -template -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; diff --git a/src/Waves/Address.h b/src/Waves/Address.h index 376d05057a8..bba6347681e 100644 --- a/src/Waves/Address.h +++ b/src/Waves/Address.h @@ -22,7 +22,9 @@ class Address : public Base58Address<26> { static const signed char testnet = 'T'; template - 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);