forked from lthn/blockchain
Merge branch 'develop' of github.com:hyle-team/zano into develop
This commit is contained in:
commit
ec92aee42e
7 changed files with 62 additions and 32 deletions
|
|
@ -15,9 +15,19 @@ set(VERSION "1.0")
|
|||
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||
#set(CMAKE_BUILD_TYPE "Debug")
|
||||
|
||||
# build types
|
||||
if (UNIX AND NOT APPLE)
|
||||
# single configurations, defaults to Release
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
else()
|
||||
# multi configurations for MSVC and XCode
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||
endif()
|
||||
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}, and built type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
enable_testing()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@
|
|||
#include "crypto.h"
|
||||
#include "hash.h"
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
# define crypto_assert(expression) assert(expression)
|
||||
#else
|
||||
# define crypto_assert(expression) ((void)0)
|
||||
#endif
|
||||
|
||||
namespace crypto {
|
||||
|
||||
DISABLE_GCC_AND_CLANG_WARNING(strict-aliasing)
|
||||
|
|
@ -143,7 +149,7 @@ namespace crypto {
|
|||
ge_p2 R = ge_p2();
|
||||
if (ge_frombytes_vartime(&A, reinterpret_cast<const unsigned char*>(&P)) != 0)
|
||||
{
|
||||
assert(false);
|
||||
crypto_assert(false);
|
||||
throw std::runtime_error(__func__);
|
||||
}
|
||||
ge_scalarmult(&R, reinterpret_cast<const unsigned char*>(&a), &A);
|
||||
|
|
@ -175,7 +181,7 @@ namespace crypto {
|
|||
ge_p3 point;
|
||||
ge_p2 point2;
|
||||
ge_p1p1 point3;
|
||||
assert(sc_check(&key2) == 0);
|
||||
crypto_assert(sc_check(&key2) == 0);
|
||||
if (ge_frombytes_vartime(&point, &key1) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -194,7 +200,11 @@ namespace crypto {
|
|||
char *end = buf.output_index;
|
||||
buf.derivation = derivation;
|
||||
tools::write_varint(end, output_index);
|
||||
assert(end <= buf.output_index + sizeof buf.output_index);
|
||||
if (!(end <= buf.output_index + sizeof buf.output_index))
|
||||
{
|
||||
crypto_assert(false);
|
||||
return;
|
||||
}
|
||||
hash_to_scalar(&buf, end - reinterpret_cast<char *>(&buf), res);
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +231,7 @@ namespace crypto {
|
|||
void crypto_ops::derive_secret_key(const key_derivation &derivation, size_t output_index,
|
||||
const secret_key &base, secret_key &derived_key) {
|
||||
ec_scalar scalar;
|
||||
assert(sc_check(&base) == 0);
|
||||
crypto_assert(sc_check(&base) == 0);
|
||||
derivation_to_scalar(derivation, output_index, scalar);
|
||||
sc_add(&derived_key, &base, &scalar);
|
||||
}
|
||||
|
|
@ -241,10 +251,10 @@ namespace crypto {
|
|||
{
|
||||
ge_p3 t;
|
||||
public_key t2;
|
||||
assert(sc_check(&sec) == 0);
|
||||
crypto_assert(sc_check(&sec) == 0);
|
||||
ge_scalarmult_base(&t, &sec);
|
||||
ge_p3_tobytes(&t2, &t);
|
||||
assert(pub == t2);
|
||||
crypto_assert(pub == t2);
|
||||
}
|
||||
#endif
|
||||
buf.h = prefix_hash;
|
||||
|
|
@ -261,7 +271,7 @@ namespace crypto {
|
|||
ge_p3 tmp3;
|
||||
ec_scalar c;
|
||||
s_comm buf;
|
||||
assert(check_key(pub));
|
||||
crypto_assert(check_key(pub));
|
||||
buf.h = prefix_hash;
|
||||
buf.key = pub;
|
||||
if (ge_frombytes_vartime(&tmp3, &pub) != 0) {
|
||||
|
|
@ -290,7 +300,7 @@ namespace crypto {
|
|||
void crypto_ops::generate_key_image(const public_key &pub, const secret_key &sec, key_image &image) {
|
||||
ge_p3 point;
|
||||
ge_p2 point2;
|
||||
assert(sc_check(&sec) == 0);
|
||||
crypto_assert(sc_check(&sec) == 0);
|
||||
hash_to_ec(pub, point);
|
||||
ge_scalarmult(&point2, &sec, &point);
|
||||
ge_tobytes(&image, &point2);
|
||||
|
|
@ -322,20 +332,24 @@ POP_WARNINGS
|
|||
ge_dsmp image_pre;
|
||||
ec_scalar sum, k, h;
|
||||
rs_comm *const buf = reinterpret_cast<rs_comm *>(alloca(rs_comm_size(pubs_count)));
|
||||
assert(sec_index < pubs_count);
|
||||
if (!(sec_index < pubs_count))
|
||||
{
|
||||
crypto_assert(false);
|
||||
return;
|
||||
}
|
||||
#if !defined(NDEBUG)
|
||||
{
|
||||
ge_p3 t;
|
||||
public_key t2;
|
||||
key_image t3;
|
||||
assert(sc_check(&sec) == 0);
|
||||
crypto_assert(sc_check(&sec) == 0);
|
||||
ge_scalarmult_base(&t, &sec);
|
||||
ge_p3_tobytes(&t2, &t);
|
||||
assert(*pubs[sec_index] == t2);
|
||||
crypto_assert(*pubs[sec_index] == t2);
|
||||
generate_key_image(*pubs[sec_index], sec, t3);
|
||||
assert(image == t3);
|
||||
crypto_assert(image == t3);
|
||||
for (i = 0; i < pubs_count; i++) {
|
||||
assert(check_key(*pubs[i]));
|
||||
crypto_assert(check_key(*pubs[i]));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -384,7 +398,7 @@ POP_WARNINGS
|
|||
rs_comm *const buf = reinterpret_cast<rs_comm *>(alloca(rs_comm_size(pubs_count)));
|
||||
#if !defined(NDEBUG)
|
||||
for (i = 0; i < pubs_count; i++) {
|
||||
assert(check_key(*pubs[i]));
|
||||
crypto_assert(check_key(*pubs[i]));
|
||||
}
|
||||
#endif
|
||||
if (ge_frombytes_vartime(&image_unp, &image) != 0) {
|
||||
|
|
|
|||
|
|
@ -866,7 +866,8 @@ var Wallet = /** @class */ (function () {
|
|||
amount: null,
|
||||
comment: null,
|
||||
mixin: null,
|
||||
fee: null
|
||||
fee: null,
|
||||
hide: null
|
||||
};
|
||||
this.wallet_id = id;
|
||||
this.name = name;
|
||||
|
|
@ -6037,7 +6038,8 @@ var SendComponent = /** @class */ (function () {
|
|||
amount: _this.variablesService.currentWallet.send_data['amount'],
|
||||
comment: _this.variablesService.currentWallet.send_data['comment'],
|
||||
mixin: _this.variablesService.currentWallet.send_data['mixin'] || 0,
|
||||
fee: _this.variablesService.currentWallet.send_data['fee'] || _this.variablesService.default_fee
|
||||
fee: _this.variablesService.currentWallet.send_data['fee'] || _this.variablesService.default_fee,
|
||||
hide: _this.variablesService.currentWallet.send_data['hide'] || false
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -6055,8 +6057,8 @@ var SendComponent = /** @class */ (function () {
|
|||
_this.backend.sendMoney(_this.currentWalletId, _this.sendForm.get('address').value, _this.sendForm.get('amount').value, _this.sendForm.get('fee').value, _this.sendForm.get('mixin').value, _this.sendForm.get('comment').value, _this.sendForm.get('hide').value, function (send_status) {
|
||||
if (send_status) {
|
||||
_this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
_this.variablesService.currentWallet.send_data = { address: null, amount: null, comment: null, mixin: null, fee: null };
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 0, fee: _this.variablesService.default_fee });
|
||||
_this.variablesService.currentWallet.send_data = { address: null, amount: null, comment: null, mixin: null, fee: null, hide: null };
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 0, fee: _this.variablesService.default_fee, hide: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -6075,8 +6077,8 @@ var SendComponent = /** @class */ (function () {
|
|||
_this.sendForm.get('amount').value, _this.sendForm.get('fee').value, _this.sendForm.get('mixin').value, _this.sendForm.get('comment').value, _this.sendForm.get('hide').value, function (send_status) {
|
||||
if (send_status) {
|
||||
_this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
_this.variablesService.currentWallet.send_data = { address: null, amount: null, comment: null, mixin: null, fee: null };
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 0, fee: _this.variablesService.default_fee });
|
||||
_this.variablesService.currentWallet.send_data = { address: null, amount: null, comment: null, mixin: null, fee: null, hide: null };
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 0, fee: _this.variablesService.default_fee, hide: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -6095,7 +6097,8 @@ var SendComponent = /** @class */ (function () {
|
|||
amount: this.sendForm.get('amount').value,
|
||||
comment: this.sendForm.get('comment').value,
|
||||
mixin: this.sendForm.get('mixin').value,
|
||||
fee: this.sendForm.get('fee').value
|
||||
fee: this.sendForm.get('fee').value,
|
||||
hide: this.sendForm.get('hide').value
|
||||
};
|
||||
};
|
||||
__decorate([
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -33,7 +33,8 @@ export class Wallet {
|
|||
amount: null,
|
||||
comment: null,
|
||||
mixin: null,
|
||||
fee: null
|
||||
fee: null,
|
||||
hide: null
|
||||
};
|
||||
|
||||
constructor(id, name, pass, path, address, balance, unlocked_balance, mined = 0, tracking = '') {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
amount: this.variablesService.currentWallet.send_data['amount'],
|
||||
comment: this.variablesService.currentWallet.send_data['comment'],
|
||||
mixin: this.variablesService.currentWallet.send_data['mixin'] || 0,
|
||||
fee: this.variablesService.currentWallet.send_data['fee'] || this.variablesService.default_fee
|
||||
fee: this.variablesService.currentWallet.send_data['fee'] || this.variablesService.default_fee,
|
||||
hide: this.variablesService.currentWallet.send_data['hide'] || false
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -151,8 +152,8 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
(send_status) => {
|
||||
if (send_status) {
|
||||
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null};
|
||||
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee});
|
||||
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null, hide: null};
|
||||
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee, hide: false});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -176,8 +177,8 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
(send_status) => {
|
||||
if (send_status) {
|
||||
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null};
|
||||
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee});
|
||||
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null, hide: null};
|
||||
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee, hide: false});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -198,7 +199,8 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
amount: this.sendForm.get('amount').value,
|
||||
comment: this.sendForm.get('comment').value,
|
||||
mixin: this.sendForm.get('mixin').value,
|
||||
fee: this.sendForm.get('fee').value
|
||||
fee: this.sendForm.get('fee').value,
|
||||
hide: this.sendForm.get('hide').value
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
#define BUILD_COMMIT_ID "@VERSION@"
|
||||
#define PROJECT_VERSION "1.0"
|
||||
#define PROJECT_VERSION_BUILD_NO 29
|
||||
#define PROJECT_VERSION_BUILD_NO 30
|
||||
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
|
||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue