diff --git a/src/discovery.cpp b/src/discovery.cpp index 2dae174..decbf1b 100644 --- a/src/discovery.cpp +++ b/src/discovery.cpp @@ -75,15 +75,10 @@ std::unique_ptr PeerDiscovery::getPeers(const std::stri // Execute the statement with the parameter vector params = {Value(hash)}; - auto result = stmt->Execute(params); + auto raw_result = stmt->Execute(params); + auto result = raw_result->Cast().Materialize(); - auto materialized_result = dynamic_cast(result.get()); - if (!materialized_result) { - throw std::runtime_error("Failed to retrieve materialized result."); - } - - return std::unique_ptr( - static_cast(result.release())); + return std::move(result); } void PeerDiscovery::removePeer(const std::string& hash, const std::string& peerId) {