mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated smartcontract code
updated lite-client and configuration smartcontract updated tonlib code
This commit is contained in:
parent
8e5bd938aa
commit
bce33f588a
46 changed files with 677 additions and 299 deletions
|
@ -35,6 +35,11 @@ void OptionsParser::set_description(std::string description) {
|
|||
|
||||
void OptionsParser::add_option(Option::Type type, char short_key, Slice long_key, Slice description,
|
||||
std::function<Status(Slice)> callback) {
|
||||
for (auto &option : options_) {
|
||||
if (option.short_key == short_key || (!long_key.empty() && long_key == option.long_key)) {
|
||||
LOG(ERROR) << "Ignore duplicated option '" << short_key << "' '" << long_key << "'";
|
||||
}
|
||||
}
|
||||
options_.push_back(Option{type, short_key, long_key.str(), description.str(), std::move(callback)});
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,11 @@ void Random::secure_bytes(unsigned char *ptr, size_t size) {
|
|||
buf_pos = buf_size;
|
||||
generation = 0;
|
||||
}
|
||||
if (ptr == nullptr) {
|
||||
td::MutableSlice(buf, buf_size).fill_zero_secure();
|
||||
buf_pos = buf_size;
|
||||
return;
|
||||
}
|
||||
if (generation != random_seed_generation.load(std::memory_order_relaxed)) {
|
||||
generation = random_seed_generation.load(std::memory_order_acquire);
|
||||
buf_pos = buf_size;
|
||||
|
@ -109,6 +114,10 @@ void Random::add_seed(Slice bytes, double entropy) {
|
|||
RAND_add(bytes.data(), static_cast<int>(bytes.size()), entropy);
|
||||
random_seed_generation++;
|
||||
}
|
||||
|
||||
void Random::secure_cleanup() {
|
||||
Random::secure_bytes(nullptr, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned int rand_device_helper() {
|
||||
|
|
|
@ -35,6 +35,7 @@ class Random {
|
|||
|
||||
// works only for current thread
|
||||
static void add_seed(Slice bytes, double entropy = 0);
|
||||
static void secure_cleanup();
|
||||
#endif
|
||||
|
||||
static uint32 fast_uint32();
|
||||
|
|
|
@ -153,10 +153,11 @@ inline char to_lower(char c) {
|
|||
return c;
|
||||
}
|
||||
|
||||
inline void to_lower_inplace(MutableSlice slice) {
|
||||
inline MutableSlice to_lower_inplace(MutableSlice slice) {
|
||||
for (auto &c : slice) {
|
||||
c = to_lower(c);
|
||||
}
|
||||
return slice;
|
||||
}
|
||||
|
||||
inline string to_lower(Slice slice) {
|
||||
|
@ -321,8 +322,8 @@ string url_encode(Slice str);
|
|||
|
||||
namespace detail {
|
||||
template <class T, class U>
|
||||
struct is_same_signedness
|
||||
: public std::integral_constant<bool, std::is_signed<T>::value == std::is_signed<U>::value> {};
|
||||
struct is_same_signedness : public std::integral_constant<bool, std::is_signed<T>::value == std::is_signed<U>::value> {
|
||||
};
|
||||
|
||||
template <class T, class Enable = void>
|
||||
struct safe_undeflying_type {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue