LCL history request and response. (#59)

Detect and request missing lcl history from another random node.
Sending lcl history response to a asked node.
Getting lcl history response and applying it.
Delete lcl that exceeds max ledger sequence.
This commit is contained in:
Asanka Indrajith
2019-11-19 07:50:33 -05:00
committed by GitHub
parent 0439ec93e2
commit 95683035b9
18 changed files with 1006 additions and 98 deletions

View File

@@ -151,6 +151,27 @@ std::string get_hash(std::string_view data)
return hash;
}
/**
* Generate blake2b hash for a given message.
* @param data unsigned char array pointer to hash data.
* @param data_length hash data length.
* @return The blake2b hash of the pointed buffer.
*/
std::string get_hash(const unsigned char * data, size_t data_length)
{
std::string hash;
hash.resize(crypto_generichash_blake2b_BYTES);
crypto_generichash_blake2b(
reinterpret_cast<unsigned char *>(hash.data()),
hash.length(),
data,
data_length,
NULL, 0);
return hash;
}
/**
* Generates blake2b hash for the given set of strings using stream hashing.
*/