Files
hpcore/src/usr/input_nonce_map.hpp
Ravin Perera 4de1bb2393 Already submitted input detection. (#170)
* Added same nonce/sig for input comparison.
* Added status response withholding for already submitted inputs.
2020-11-26 23:27:40 +05:30

21 lines
538 B
C++

#ifndef _HP_USR_INPUT_NONCE_MAP_
#define _HP_USR_INPUT_NONCE_MAP_
#include "../pchheader.hpp"
namespace usr
{
class input_nonce_map
{
private:
// Keeps short-lived nonces and signatures with their absolute expiration time.
std::unordered_map<std::string, std::tuple<std::string, std::string, uint64_t>> nonce_map;
void cleanup();
public:
int check(const std::string &pubkey, const std::string &nonce, const std::string &sig, const bool no_add = false);
};
} // namespace usr
#endif