forked from lthn/blockchain
Merge branch 'master' into offsig
# Conflicts: # tests/core_tests/multisig_wallet_tests.cpp
This commit is contained in:
commit
5435bdbc01
57 changed files with 1196 additions and 584 deletions
|
|
@ -873,7 +873,13 @@ bool blockchain_storage::switch_to_alternative_blockchain(alt_chain_type& alt_ch
|
|||
LOG_ERROR("Failed to push ex-main chain blocks to alternative chain ");
|
||||
rollback_blockchain_switching(disconnected_chain, split_height);
|
||||
CHECK_AND_ASSERT_MES(validate_blockchain_prev_links(), false, "EPIC FAIL!");
|
||||
return false;
|
||||
|
||||
//can't do return false here, because of the risc to get stuck in "PANIC" mode when nor of
|
||||
//new chain nor altchain can be inserted into main chain. Got core caught in this trap when
|
||||
//when machine time was wrongly set for a few hours back, then blocks which was detached from main chain
|
||||
//couldn't be added as alternative due to timestamps validation(timestamps assumed as from future)
|
||||
//thanks @Gigabyted for reporting this problem
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2870,7 +2876,7 @@ bool blockchain_storage::pop_alias_info(const extra_alias_entry& ai)
|
|||
m_db_addr_to_alias.set(local_alias_hist.back().m_address, local_copy);
|
||||
}
|
||||
|
||||
LOG_PRINT_MAGENTA("[ALIAS_UNREGISTERED]: " << ai.m_alias << ": " << get_account_address_as_str(ai.m_address) << " -> " << (!alias_history_ptr->empty() ? get_account_address_as_str(alias_history_ptr->back().m_address) : "(available)"), LOG_LEVEL_0);
|
||||
LOG_PRINT_MAGENTA("[ALIAS_UNREGISTERED]: " << ai.m_alias << ": " << get_account_address_as_str(ai.m_address) << " -> " << (!local_alias_hist.empty() ? get_account_address_as_str(local_alias_hist.back().m_address) : "(available)"), LOG_LEVEL_1);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
|
@ -2957,7 +2963,7 @@ bool blockchain_storage::put_alias_info(const transaction & tx, extra_alias_entr
|
|||
addr_to_alias_local2.insert(ai.m_alias);
|
||||
m_db_addr_to_alias.set(local_alias_history.back().m_address, addr_to_alias_local2);
|
||||
|
||||
LOG_PRINT_MAGENTA("[ALIAS_UPDATED]: " << ai.m_alias << ": from: " << old_address << " to " << get_account_address_as_str(ai.m_address), LOG_LEVEL_0);
|
||||
LOG_PRINT_MAGENTA("[ALIAS_UPDATED]: " << ai.m_alias << ": from: " << old_address << " to " << get_account_address_as_str(ai.m_address), LOG_LEVEL_1);
|
||||
rise_core_event(CORE_EVENT_UPDATE_ALIAS, alias_info_to_rpc_update_alias_info(ai, old_address));
|
||||
|
||||
}
|
||||
|
|
@ -3459,7 +3465,10 @@ bool blockchain_storage::have_tx_keyimges_as_spent(const transaction &tx) const
|
|||
if (in.type() == typeid(txin_to_key))
|
||||
{
|
||||
if (have_tx_keyimg_as_spent(boost::get<const txin_to_key>(in).k_image))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
else if (in.type() == typeid(txin_multisig))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#define BASE_REWARD_DUST_THRESHOLD ((uint64_t)1000000) // pow(10, 6) - change this will cause hard-fork!
|
||||
#define DEFAULT_DUST_THRESHOLD ((uint64_t)0)//((uint64_t)100000) // pow(10, 5)
|
||||
|
||||
#define TX_DEFAULT_FEE ((uint64_t)100000) // pow(10, 5)
|
||||
#define TX_DEFAULT_FEE ((uint64_t)10000000000) // pow(10, 5)
|
||||
#define TX_MINIMUM_FEE ((uint64_t)100000) // pow(10, 5)
|
||||
|
||||
// #define CURRENCY_FIXED_REWARD_ZONE_HEIGHT 300 // blocks will have fixed reward up to this height (including)
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@ namespace currency
|
|||
return true;
|
||||
|
||||
// maximum age check - remove too old
|
||||
uint64_t tx_age = get_core_time() - tx_entry.receive_time;
|
||||
int64_t tx_age = get_core_time() - tx_entry.receive_time;
|
||||
if ((tx_age > CURRENCY_MEMPOOL_TX_LIVETIME ))
|
||||
{
|
||||
|
||||
|
|
@ -777,16 +777,14 @@ namespace currency
|
|||
//---------------------------------------------------------------------------------
|
||||
bool tx_memory_pool::on_tx_add(const transaction& tx, bool kept_by_block)
|
||||
{
|
||||
if (!kept_by_block)
|
||||
insert_key_images(tx, kept_by_block); // take into account only key images from txs that are not 'kept_by_block'
|
||||
insert_key_images(tx, kept_by_block);
|
||||
insert_alias_info(tx);
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
bool tx_memory_pool::on_tx_remove(const transaction& tx, bool kept_by_block)
|
||||
{
|
||||
if (!kept_by_block)
|
||||
remove_key_images(tx, kept_by_block); // take into account only key images from txs that are not 'kept_by_block'
|
||||
remove_key_images(tx, kept_by_block);
|
||||
remove_alias_info(tx);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -944,8 +942,11 @@ namespace currency
|
|||
}
|
||||
}
|
||||
//if we here, transaction seems valid, but, anyway, check for key_images collisions with blockchain, just to be sure
|
||||
if(m_blockchain.have_tx_keyimges_as_spent(txd.tx))
|
||||
if (m_blockchain.have_tx_keyimges_as_spent(txd.tx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!check_tx_multisig_ins_and_outs(txd.tx, false))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -134,9 +134,8 @@ namespace currency
|
|||
uint64_t get_core_time() const;
|
||||
bool get_aliases_from_tx_pool(std::list<extra_alias_entry>& aliases)const;
|
||||
bool get_aliases_from_tx_pool(std::map<std::string, size_t>& aliases)const;
|
||||
//crypto::hash get_last_core_hash() {return m_last_core_top_hash;}
|
||||
//void set_last_core_hash(const crypto::hash& h) { m_last_core_top_hash = h; }
|
||||
|
||||
|
||||
bool remove_stuck_transactions(); // made public to be called from coretests
|
||||
|
||||
private:
|
||||
bool on_tx_add(const transaction& tx, bool kept_by_block);
|
||||
|
|
@ -148,7 +147,6 @@ namespace currency
|
|||
|
||||
bool is_valid_contract_finalization_tx(const transaction &tx)const;
|
||||
void initialize_db_solo_options_values();
|
||||
bool remove_stuck_transactions();
|
||||
bool is_transaction_ready_to_go(tx_details& txd, const crypto::hash& id)const;
|
||||
bool validate_alias_info(const transaction& tx, bool is_in_block)const;
|
||||
bool get_key_images_from_tx_pool(std::unordered_set<crypto::key_image>& key_images)const;
|
||||
|
|
@ -181,7 +179,6 @@ namespace currency
|
|||
address_to_aliases_container m_db_alias_addresses;
|
||||
solo_options_container m_db_solo_options;
|
||||
tools::db::solo_db_value<uint64_t, uint64_t, solo_options_container> m_db_storage_major_compatibility_version;
|
||||
//crypto::hash m_last_core_top_hash;
|
||||
|
||||
|
||||
epee::math_helper::once_a_time_seconds<30> m_remove_stuck_tx_interval;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "crypto/hash.h"
|
||||
#include "warnings.h"
|
||||
#include "currency_core/bc_offers_service.h"
|
||||
#include "serialization/binary_utils.h"
|
||||
|
||||
PUSH_WARNINGS
|
||||
DISABLE_VS_WARNINGS(4100)
|
||||
|
|
@ -64,6 +65,8 @@ public:
|
|||
m_cmd_binder.set_handler("rescan_aliases", boost::bind(&daemon_cmmands_handler::rescan_aliases, this, _1), "Debug function");
|
||||
m_cmd_binder.set_handler("forecast_difficulty", boost::bind(&daemon_cmmands_handler::forecast_difficulty, this, _1), "Prints PoW and PoS difficulties for as many future blocks as possible based on current conditions");
|
||||
m_cmd_binder.set_handler("print_deadlock_guard", boost::bind(&daemon_cmmands_handler::print_deadlock_guard, this, _1), "Print all threads which is blocked or involved in mutex ownership");
|
||||
m_cmd_binder.set_handler("print_block_from_hex_blob", boost::bind(&daemon_cmmands_handler::print_block_from_hex_blob, this, _1), "Unserialize block from hex binary data to json-like representation");
|
||||
m_cmd_binder.set_handler("print_tx_from_hex_blob", boost::bind(&daemon_cmmands_handler::print_tx_from_hex_blob, this, _1), "Unserialize transaction from hex binary data to json-like representation");
|
||||
}
|
||||
|
||||
bool start_handling()
|
||||
|
|
@ -356,6 +359,101 @@ private:
|
|||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
template<class t_item>
|
||||
bool print_t_from_hex_blob(const std::string& item_hex_blob)
|
||||
{
|
||||
std::string bin_buff;
|
||||
bool res = epee::string_tools::parse_hexstr_to_binbuff(item_hex_blob, bin_buff);
|
||||
CHECK_AND_ASSERT_MES(res, false, "failed to parse hex");
|
||||
|
||||
t_item item = AUTO_VAL_INIT(item);
|
||||
|
||||
res = ::serialization::parse_binary(bin_buff, item);
|
||||
CHECK_AND_ASSERT_MES(res, false, "failed to parse binary");
|
||||
|
||||
|
||||
LOG_PRINT_L0("OBJECT " << typeid(item).name() << ": " << ENDL << obj_to_json_str(item));
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool print_block_from_hex_blob(const std::vector<std::string>& args)
|
||||
{
|
||||
if (!args.size())
|
||||
{
|
||||
std::cout << "need block blob parameter" << ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
print_t_from_hex_blob<currency::block>(args[0]);
|
||||
|
||||
LOG_PRINT_GREEN("Done", LOG_LEVEL_0);
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool print_tx_from_hex_blob(const std::vector<std::string>& args)
|
||||
{
|
||||
if (!args.size())
|
||||
{
|
||||
std::cout << "need block blob parameter" << ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
print_t_from_hex_blob<currency::transaction>(args[0]);
|
||||
|
||||
LOG_PRINT_GREEN("Done", LOG_LEVEL_0);
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
struct tx_pool_exported_blobs
|
||||
{
|
||||
std::list<currency::tx_rpc_extended_info> all_txs_details;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(all_txs_details)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
//--------------------------------------------------------------------------------
|
||||
bool export_tx_pool_to_json(const std::vector<std::string>& args)
|
||||
{
|
||||
// if (!args.size())
|
||||
// {
|
||||
// std::cout << "need block blob parameter" << ENDL;
|
||||
// return false;
|
||||
// }
|
||||
// tx_pool_exported_blobs tx_pool_json;
|
||||
// m_srv.get_payload_object().get_core().get_tx_pool().get_all_transactions_details(tx_pool_json.all_txs_details);
|
||||
// std::string pool_state = epee::serialization::store_t_to_json(tx_pool_json);
|
||||
// CHECK_AND_ASSERT_THROW(pool_state.size(), false, "Unable to export pool");
|
||||
//
|
||||
// bool r = file_io_utils::save_string_to_file(args[0], pool_state);
|
||||
// CHECK_AND_ASSERT_THROW(r, false, "Unable to export pool");
|
||||
// LOG_PRINT_GREEN("Exported OK(" << tx_pool_json.all_txs_details.size() <<" transactions)");
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool import_tx_pool_to_json(const std::vector<std::string>& args)
|
||||
{
|
||||
// if (!args.size())
|
||||
// {
|
||||
// std::cout << "need block blob parameter" << ENDL;
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// std::string buff;
|
||||
// bool r = file_io_utils::load_file_to_string(args[0], buff);
|
||||
//
|
||||
// tx_pool_exported_blobs tx_pool_json;
|
||||
//
|
||||
//
|
||||
// m_srv.get_payload_object().get_core().get_tx_pool().get_all_transactions_details(tx_pool_json.all_txs_details);
|
||||
// std::string pool_state = epee::serialization::store_t_to_json(tx_pool_json);
|
||||
// CHECK_AND_ASSERT_THROW(pool_state.size(), false, "Unable to export pool");
|
||||
//
|
||||
//
|
||||
// CHECK_AND_ASSERT_THROW(r, false, "Unable to export pool");
|
||||
// LOG_PRINT_GREEN("Exported OK(" << tx_pool_json.all_txs_details.size() << " transactions)");
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool print_bci(const std::vector<std::string>& args)
|
||||
{
|
||||
m_srv.get_payload_object().get_core().print_blockchain_index();
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@
|
|||
},
|
||||
"SEED_PHRASE": {
|
||||
"TITLE": "Make sure to keep your seed phrase in a safe place. If you forget your seed phrase you will not be able to recover your wallet.",
|
||||
"BUTTON_CREATE_ACCOUNT" : "Create wallet"
|
||||
"BUTTON_CREATE_ACCOUNT" : "Create wallet",
|
||||
"BUTTON_COPY" : "Copy"
|
||||
},
|
||||
"PROGRESS": {
|
||||
"ADD_WALLET": "Add wallet",
|
||||
|
|
@ -257,13 +258,14 @@
|
|||
"AMOUNT_REQUIRED": "Amount is required.",
|
||||
"AMOUNT_ZERO": "Amount is zero.",
|
||||
"FEE_REQUIRED": "Fee is required.",
|
||||
"FEE_MINIMUM": "Minimum fee: {{fee}}"
|
||||
"FEE_MINIMUM": "Minimum fee: {{fee}}",
|
||||
"MAX_LENGTH": "Maximum comment length reached."
|
||||
}
|
||||
},
|
||||
"HISTORY": {
|
||||
"STATUS": "Status",
|
||||
"STATUS_TOOLTIP": "Confirmations {{current}}/{{total}}",
|
||||
"SEND": "Send",
|
||||
"SEND": "Sent",
|
||||
"RECEIVED": "Received",
|
||||
"DATE": "Date",
|
||||
"AMOUNT": "Amount",
|
||||
|
|
@ -374,6 +376,7 @@
|
|||
"DESC_MAXIMUM": "Maximum field length reached.",
|
||||
"SELLER_REQUIRED": "Seller is required.",
|
||||
"SELLER_NOT_VALID": "Seller not valid.",
|
||||
"ALIAS_NOT_VALID": "Alias not valid.",
|
||||
"AMOUNT_REQUIRED": "Amount is required.",
|
||||
"YOUR_DEPOSIT_REQUIRED": "Your deposit is required.",
|
||||
"YOUR_DEPOSIT_TOO_SMALL": "Your deposit should be equal or greater than amount.",
|
||||
|
|
@ -472,7 +475,7 @@
|
|||
"NO_MONEY": "Not enough money",
|
||||
"NOT_ENOUGH_MONEY": "Insufficient funds in account",
|
||||
"CORE_BUSY": "Internal error (core is busy)",
|
||||
"DAEMON_BUSY": "Internal error: deamon is busy",
|
||||
"DAEMON_BUSY": "Internal error: daemon is busy",
|
||||
"NO_MONEY_REMOVE_OFFER": "There is no fee for deleting an offer, but in order to protect the network against flood transactions you need to have at least {{fee}} {{currency}} in your wallet",
|
||||
"NOT_ENOUGH_OUTPUTS_TO_MIX": "Mix-in number is too big for current blockchain state. There are not enough unspent outputs to mix with",
|
||||
"TRANSACTION_IS_TO_BIG": "Transaction exceeds network limit, send required amount with multiple transactions",
|
||||
|
|
|
|||
|
|
@ -566,6 +566,13 @@ input[type='checkbox'].style-checkbox {
|
|||
max-width: 18rem;
|
||||
}
|
||||
|
||||
.comment-tooltip {
|
||||
overflow: auto;
|
||||
word-break: break-word;
|
||||
max-width: 50rem;
|
||||
max-height: 25rem;
|
||||
}
|
||||
|
||||
.ngx-contextmenu {
|
||||
|
||||
.dropdown-menu {
|
||||
|
|
@ -625,6 +632,10 @@ input[type='checkbox'].style-checkbox {
|
|||
|
||||
.ng-value-container {
|
||||
padding: 0;
|
||||
|
||||
.ng-input {
|
||||
top: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,24 +99,6 @@ app-send {
|
|||
|
||||
.form-send {
|
||||
|
||||
.input-block-address {
|
||||
|
||||
.address-dropdown {
|
||||
|
||||
@include themify($themes) {
|
||||
background-color: themed(inputBackgroundColor);
|
||||
color: themed(mainTextColor);
|
||||
}
|
||||
|
||||
|
||||
div:hover {
|
||||
@include themify($themes) {
|
||||
background-color: themed(selectHoverColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.send-select {
|
||||
|
||||
@include themify($themes) {
|
||||
|
|
@ -449,3 +431,31 @@ app-staking {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-block-alias {
|
||||
position: relative;
|
||||
|
||||
.alias-dropdown {
|
||||
position: absolute;
|
||||
top: 6.5rem;
|
||||
max-height: 10rem;
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
|
||||
@include themify($themes) {
|
||||
background-color: themed(inputBackgroundColor);
|
||||
color: themed(mainTextColor);
|
||||
}
|
||||
|
||||
div {
|
||||
font-size: 1.4rem;
|
||||
padding: 1rem;
|
||||
|
||||
&:hover {
|
||||
@include themify($themes) {
|
||||
background-color: themed(selectHoverColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -13,12 +13,16 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<span class="cell label" [style.flex-basis]="sizes[0] + 'px'">{{ 'HISTORY.DETAILS.INPUTS' | translate }}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[1] + 'px'" tooltip="{{inputs.join('\n')}}" placement="top" tooltipClass="table-tooltip" [delay]="500" [showWhenNoOverflow]="false">{{inputs.join(', ')}}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[1] + 'px'" tooltip="{{inputs.join(', ')}}" placement="top" tooltipClass="table-tooltip table-tooltip-width" [delay]="500" [showWhenNoOverflow]="false">{{inputs.join(', ')}}</span>
|
||||
<span class="cell label" [style.flex-basis]="sizes[2] + 'px'">{{ 'HISTORY.DETAILS.OUTPUTS' | translate }}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[3] + 'px'" tooltip="{{outputs.join('\n')}}" placement="top" tooltipClass="table-tooltip" [delay]="500" [showWhenNoOverflow]="false">{{outputs.join(', ')}}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[3] + 'px'" tooltip="{{outputs.join(', ')}}" placement="top" tooltipClass="table-tooltip table-tooltip-width" [delay]="500" [showWhenNoOverflow]="false">{{outputs.join(', ')}}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="cell label" [style.flex-basis]="sizes[0] + 'px'">{{ 'HISTORY.DETAILS.COMMENT' | translate }}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[1] + sizes[2] + sizes[3] + 'px'">{{transaction.comment}}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[1] + sizes[2] + sizes[3] + 'px'"
|
||||
tooltip="{{transaction.comment}}" placement="top" tooltipClass="table-tooltip comment-tooltip scrolled-content" [delay]="500" [showWhenNoOverflow]="false"
|
||||
(contextmenu)="variablesService.onContextMenuOnlyCopy($event, transaction.comment)">
|
||||
{{transaction.comment}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -41,3 +41,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-tooltip-width {
|
||||
max-width: 20rem;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,11 +104,11 @@ export class ContractStatusMessagesPipe implements PipeTransform {
|
|||
return state.part1 + (state.part2.length ? '. ' + state.part2 : '');
|
||||
}
|
||||
|
||||
transform(item: any, args?: any): any {
|
||||
if (item.is_a) {
|
||||
return this.getStateBuyer(item.state);
|
||||
transform(state: number, is_a?: boolean): any {
|
||||
if (is_a) {
|
||||
return this.getStateBuyer(state);
|
||||
} else {
|
||||
return this.getStateSeller(item.state);
|
||||
return this.getStateSeller(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,9 @@ export class BackendService {
|
|||
if (error.indexOf('FAIL:failed to save file') > -1) {
|
||||
error_translate = 'ERRORS.FILE_NOT_SAVED';
|
||||
}
|
||||
if (error.indexOf('FAILED:failed to open binary wallet file for saving') > -1 && command === 'generate_wallet') {
|
||||
error_translate = '';
|
||||
}
|
||||
if (error_translate !== '') {
|
||||
this.modalService.prepareModal('error', error_translate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ export class VariablesService {
|
|||
public maxWalletNameLength = 25;
|
||||
public maxCommentLength = 255;
|
||||
|
||||
getExpMedTsEvent = new BehaviorSubject(null);
|
||||
getHeightAppEvent = new BehaviorSubject(null);
|
||||
getRefreshStackingEvent = new BehaviorSubject(null);
|
||||
getAliasChangedEvent = new BehaviorSubject(null);
|
||||
|
|
@ -70,6 +71,13 @@ export class VariablesService {
|
|||
constructor(private router: Router, private ngZone: NgZone, private contextMenuService: ContextMenuService) {
|
||||
}
|
||||
|
||||
setExpMedTs(timestamp: number) {
|
||||
if (timestamp !== this.exp_med_ts) {
|
||||
this.exp_med_ts = timestamp;
|
||||
this.getExpMedTsEvent.next(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
setHeightApp(height: number) {
|
||||
if (height !== this.height_app) {
|
||||
this.height_app = height;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import {ModalService} from './_helpers/services/modal.service';
|
|||
export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
intervalUpdateContractsState;
|
||||
expMedTsEvent;
|
||||
onQuitRequest = false;
|
||||
firstOnlineState = false;
|
||||
|
||||
|
|
@ -154,7 +155,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
console.log('----------------- update_daemon_state -----------------');
|
||||
console.log('DAEMON:' + data.daemon_network_state);
|
||||
console.log(data);
|
||||
this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
|
||||
// this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
|
||||
this.variablesService.setExpMedTs(data['expiration_median_timestamp'] + 600 + 1);
|
||||
this.variablesService.last_build_available = data.last_build_available;
|
||||
this.variablesService.setHeightApp(data.height);
|
||||
|
||||
|
|
@ -411,13 +413,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
comment: data.events[i].details.comment
|
||||
};
|
||||
this.variablesService.aliases = this.variablesService.aliases.concat(newAlias);
|
||||
// this.variablesService.aliases = this.variablesService.aliases.sort((a, b) => {
|
||||
// if (a.name.length > b.name.length) return 1;
|
||||
// if (a.name.length < b.name.length) return -1;
|
||||
// if (a.name > b.name) return 1;
|
||||
// if (a.name < b.name) return -1;
|
||||
// return 0;
|
||||
// });
|
||||
this.variablesService.changeAliases();
|
||||
}
|
||||
break;
|
||||
|
|
@ -472,6 +467,22 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}, 30000);
|
||||
|
||||
this.expMedTsEvent = this.variablesService.getExpMedTsEvent.subscribe((newTimestamp: number) => {
|
||||
this.variablesService.wallets.forEach((wallet) => {
|
||||
wallet.contracts.forEach((contract) => {
|
||||
if (contract.state === 1 && contract.expiration_time <= newTimestamp) {
|
||||
contract.state = 110;
|
||||
contract.is_new = true;
|
||||
wallet.recountNewContracts();
|
||||
} else if (contract.state === 5 && contract.cancel_expiration_time <= newTimestamp) {
|
||||
contract.state = 130;
|
||||
contract.is_new = true;
|
||||
wallet.recountNewContracts();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
this.backend.getAppData((status, data) => {
|
||||
if (data && Object.keys(data).length > 0) {
|
||||
|
|
@ -642,6 +653,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
if (this.intervalUpdateContractsState) {
|
||||
clearInterval(this.intervalUpdateContractsState);
|
||||
}
|
||||
this.expMedTsEvent.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of variablesService.currentWallet.contracts" [routerLink]="'/wallet/' + walletId + '/purchase/' + item.contract_id">
|
||||
<tr *ngFor="let item of sortedArrayContracts" [routerLink]="'/wallet/' + walletId + '/purchase/' + item.contract_id">
|
||||
<td>
|
||||
<div class="contract">
|
||||
<i class="icon alert" *ngIf="!item.is_new"></i>
|
||||
|
|
@ -31,8 +31,8 @@
|
|||
<div>{{item.private_detailes.to_pay | intToMoney}} {{variablesService.defaultCurrency}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="status" [class.error-text]="item.state === 4" tooltip="{{ item | contractStatusMessages }}" placement="top" tooltipClass="table-tooltip" [delay]="500">
|
||||
{{item | contractStatusMessages}}
|
||||
<div class="status" [class.error-text]="item.state === 4" tooltip="{{item.state | contractStatusMessages : item.is_a}}" placement="top" tooltipClass="table-tooltip" [delay]="500">
|
||||
{{item.state | contractStatusMessages : item.is_a}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, OnInit, OnDestroy} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
|
||||
@Component({
|
||||
|
|
@ -14,11 +14,28 @@ export class ContractsComponent implements OnInit, OnDestroy {
|
|||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private variablesService: VariablesService
|
||||
public variablesService: VariablesService
|
||||
) {
|
||||
}
|
||||
|
||||
public get sortedArrayContracts(): any[] {
|
||||
return this.variablesService.currentWallet.contracts.sort((a, b) => {
|
||||
if (a.is_new < b.is_new) {
|
||||
return 1;
|
||||
}
|
||||
if (a.is_new > b.is_new) {
|
||||
return -1;
|
||||
}
|
||||
if (a.timestamp < b.timestamp) {
|
||||
return 1;
|
||||
}
|
||||
if (a.timestamp > b.timestamp) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.parentRouting = this.route.parent.params.subscribe(params => {
|
||||
if (params.hasOwnProperty('id')) {
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@
|
|||
</div>
|
||||
|
||||
<div class="input-blocks-row">
|
||||
<div class="input-block">
|
||||
<div class="input-block input-block-alias">
|
||||
<label for="purchase-seller">{{ 'PURCHASE.SELLER' | translate }}</label>
|
||||
<input type="text" id="purchase-seller" formControlName="seller" [readonly]="!newPurchase" appInputDisableSelection (contextmenu)="(!newPurchase) ? variablesService.onContextMenuOnlyCopy($event, purchaseForm.controls['seller'].value) : variablesService.onContextMenu($event)">
|
||||
<input type="text" id="purchase-seller" formControlName="seller" [readonly]="!newPurchase" (mousedown)="addressMouseDown($event)" (contextmenu)="(!newPurchase) ? variablesService.onContextMenuOnlyCopy($event, purchaseForm.controls['seller'].value) : variablesService.onContextMenu($event)">
|
||||
<div class="alias-dropdown scrolled-content" *ngIf="isOpen">
|
||||
<div *ngFor="let item of localAliases" (click)="setAlias(item.name)">{{item.name}}</div>
|
||||
</div>
|
||||
<div class="error-block" *ngIf="purchaseForm.controls['seller'].invalid && (purchaseForm.controls['seller'].dirty || purchaseForm.controls['seller'].touched)">
|
||||
<div *ngIf="purchaseForm.controls['seller'].errors['required']">
|
||||
{{ 'PURCHASE.FORM_ERRORS.SELLER_REQUIRED' | translate }}
|
||||
|
|
@ -41,6 +44,9 @@
|
|||
<div *ngIf="purchaseForm.controls['seller'].errors['address_same']">
|
||||
{{ 'PURCHASE.FORM_ERRORS.SELLER_SAME' | translate }}
|
||||
</div>
|
||||
<div *ngIf="purchaseForm.controls['seller'].errors['alias_not_valid']">
|
||||
{{ 'PURCHASE.FORM_ERRORS.ALIAS_NOT_VALID' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, OnInit, OnDestroy, NgZone} from '@angular/core';
|
||||
import {Component, OnInit, OnDestroy, NgZone, HostListener} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {FormControl, FormGroup, Validators} from '@angular/forms';
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
|
|
@ -15,6 +15,10 @@ import {BigNumber} from 'bignumber.js';
|
|||
styleUrls: ['./purchase.component.scss']
|
||||
})
|
||||
export class PurchaseComponent implements OnInit, OnDestroy {
|
||||
|
||||
isOpen = false;
|
||||
localAliases = [];
|
||||
|
||||
currentWalletId;
|
||||
newPurchase = false;
|
||||
parentRouting;
|
||||
|
|
@ -29,22 +33,50 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
return null;
|
||||
}, (g: FormControl) => {
|
||||
this.localAliases = [];
|
||||
if (g.value) {
|
||||
this.backend.validateAddress(g.value, (valid_status) => {
|
||||
this.ngZone.run(() => {
|
||||
if (valid_status === false) {
|
||||
g.setErrors(Object.assign({'address_not_valid': true}, g.errors) );
|
||||
} else {
|
||||
if (g.hasError('address_not_valid')) {
|
||||
delete g.errors['address_not_valid'];
|
||||
if (Object.keys(g.errors).length === 0) {
|
||||
g.setErrors(null);
|
||||
if (g.value.indexOf('@') !== 0) {
|
||||
this.isOpen = false;
|
||||
this.backend.validateAddress(g.value, (valid_status) => {
|
||||
this.ngZone.run(() => {
|
||||
if (valid_status === false) {
|
||||
g.setErrors(Object.assign({'address_not_valid': true}, g.errors));
|
||||
} else {
|
||||
if (g.hasError('address_not_valid')) {
|
||||
delete g.errors['address_not_valid'];
|
||||
if (Object.keys(g.errors).length === 0) {
|
||||
g.setErrors(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
return (g.hasError('address_not_valid')) ? {'address_not_valid': true} : null;
|
||||
return (g.hasError('address_not_valid')) ? {'address_not_valid': true} : null;
|
||||
} else {
|
||||
this.isOpen = true;
|
||||
this.localAliases = this.variablesService.aliases.filter((item) => {
|
||||
return item.name.indexOf(g.value) > -1;
|
||||
});
|
||||
if (!(/^@?[a-z0-9\.\-]{6,25}$/.test(g.value))) {
|
||||
g.setErrors(Object.assign({'alias_not_valid': true}, g.errors));
|
||||
} else {
|
||||
this.backend.getAliasByName(g.value.replace('@', ''), (alias_status) => {
|
||||
this.ngZone.run(() => {
|
||||
if (alias_status) {
|
||||
if (g.hasError('alias_not_valid')) {
|
||||
delete g.errors['alias_not_valid'];
|
||||
if (Object.keys(g.errors).length === 0) {
|
||||
g.setErrors(null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g.setErrors(Object.assign({'alias_not_valid': true}, g.errors));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return (g.hasError('alias_not_valid')) ? {'alias_not_valid': true} : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}]),
|
||||
|
|
@ -74,8 +106,7 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
private modalService: ModalService,
|
||||
private ngZone: NgZone,
|
||||
private location: Location,
|
||||
private intToMoneyPipe: IntToMoneyPipe,
|
||||
private translate: TranslateService
|
||||
private intToMoneyPipe: IntToMoneyPipe
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -87,6 +118,23 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
addressMouseDown(e) {
|
||||
if (e['button'] === 0 && this.purchaseForm.get('seller').value && this.purchaseForm.get('seller').value.indexOf('@') === 0) {
|
||||
this.isOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
setAlias(alias) {
|
||||
this.purchaseForm.get('seller').setValue(alias);
|
||||
}
|
||||
|
||||
@HostListener('document:click', ['$event.target'])
|
||||
public onClick(targetElement) {
|
||||
if (targetElement.id !== 'purchase-seller' && this.isOpen) {
|
||||
this.isOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.parentRouting = this.route.parent.params.subscribe(params => {
|
||||
this.currentWalletId = params['id'];
|
||||
|
|
@ -158,13 +206,7 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
this.currentContract.is_new = true;
|
||||
this.variablesService.currentWallet.recountNewContracts();
|
||||
}
|
||||
// if (!this.newPurchase && this.currentContract.is_a && (this.currentContract.state === 201 || this.currentContract.state === 2 || this.currentContract.state === 120 || this.currentContract.state === 130)) {
|
||||
// if (this.currentContract.cancel_expiration_time === 0 && (this.currentContract.height === 0 || (this.variablesService.height_app - this.currentContract.height) < 10)) {
|
||||
// this.purchaseForm.get('timeCancel').disable();
|
||||
// } else {
|
||||
// this.purchaseForm.get('timeCancel').enable();
|
||||
// }
|
||||
// }
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -198,25 +240,54 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
|
||||
createPurchase() {
|
||||
if (this.purchaseForm.valid) {
|
||||
if (this.purchaseForm.get('sameAmount').value) {
|
||||
this.purchaseForm.get('sellerDeposit').setValue(this.purchaseForm.get('amount').value);
|
||||
}
|
||||
this.backend.createProposal(
|
||||
this.variablesService.currentWallet.wallet_id,
|
||||
this.purchaseForm.get('description').value,
|
||||
this.purchaseForm.get('comment').value,
|
||||
this.variablesService.currentWallet.address,
|
||||
this.purchaseForm.get('seller').value,
|
||||
this.purchaseForm.get('amount').value,
|
||||
this.purchaseForm.get('yourDeposit').value,
|
||||
this.purchaseForm.get('sellerDeposit').value,
|
||||
this.purchaseForm.get('time').value,
|
||||
this.purchaseForm.get('payment').value,
|
||||
(create_status) => {
|
||||
if (create_status) {
|
||||
this.back();
|
||||
}
|
||||
if (this.purchaseForm.get('seller').value.indexOf('@') !== 0) {
|
||||
if (this.purchaseForm.get('sameAmount').value) {
|
||||
this.purchaseForm.get('sellerDeposit').setValue(this.purchaseForm.get('amount').value);
|
||||
}
|
||||
this.backend.createProposal(
|
||||
this.variablesService.currentWallet.wallet_id,
|
||||
this.purchaseForm.get('description').value,
|
||||
this.purchaseForm.get('comment').value,
|
||||
this.variablesService.currentWallet.address,
|
||||
this.purchaseForm.get('seller').value,
|
||||
this.purchaseForm.get('amount').value,
|
||||
this.purchaseForm.get('yourDeposit').value,
|
||||
this.purchaseForm.get('sellerDeposit').value,
|
||||
this.purchaseForm.get('time').value,
|
||||
this.purchaseForm.get('payment').value,
|
||||
(create_status) => {
|
||||
if (create_status) {
|
||||
this.back();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.backend.getAliasByName(this.purchaseForm.get('seller').value.replace('@', ''), (alias_status, alias_data) => {
|
||||
this.ngZone.run(() => {
|
||||
if (alias_status === false) {
|
||||
this.ngZone.run(() => {
|
||||
this.purchaseForm.get('seller').setErrors({'alias_not_valid': true});
|
||||
});
|
||||
} else {
|
||||
this.backend.createProposal(
|
||||
this.variablesService.currentWallet.wallet_id,
|
||||
this.purchaseForm.get('description').value,
|
||||
this.purchaseForm.get('comment').value,
|
||||
this.variablesService.currentWallet.address,
|
||||
alias_data.address,
|
||||
this.purchaseForm.get('amount').value,
|
||||
this.purchaseForm.get('yourDeposit').value,
|
||||
this.purchaseForm.get('sellerDeposit').value,
|
||||
this.purchaseForm.get('time').value,
|
||||
this.purchaseForm.get('payment').value,
|
||||
(create_status) => {
|
||||
if (create_status) {
|
||||
this.back();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,11 @@
|
|||
</ng-container>
|
||||
</div>
|
||||
|
||||
<button type="button" class="blue-button seed-phrase-button" (click)="runWallet()">{{ 'SEED_PHRASE.BUTTON_CREATE_ACCOUNT' | translate }}</button>
|
||||
|
||||
<div class="wrap-buttons">
|
||||
<button type="button" class="blue-button seed-phrase-button" (click)="runWallet()">{{ 'SEED_PHRASE.BUTTON_CREATE_ACCOUNT' | translate }}</button>
|
||||
<button type="button" class="blue-button copy-button" *ngIf="!seedPhraseCopied" (click)="copySeedPhrase()">{{ 'SEED_PHRASE.BUTTON_COPY' | translate }}</button>
|
||||
<button type="button" class="transparent-button copy-button" *ngIf="seedPhraseCopied" disabled><i class="icon"></i>{{ 'SEED_PHRASE.BUTTON_COPY' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-progress-container [width]="'100%'" [labels]="['PROGRESS.ADD_WALLET', 'PROGRESS.SELECT_LOCATION', 'PROGRESS.CREATE_WALLET']"></app-progress-container>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
.seed-phrase-button {
|
||||
margin: 2.8rem 0;
|
||||
width: 25%;
|
||||
min-width: 1.5rem;
|
||||
.wrap-buttons {
|
||||
display: flex;
|
||||
|
||||
.seed-phrase-button {
|
||||
margin: 2.8rem 0;
|
||||
width: 25%;
|
||||
min-width: 1.5rem;
|
||||
}
|
||||
|
||||
.copy-button {
|
||||
margin: 2.8rem 1rem;
|
||||
width: 25%;
|
||||
min-width: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,16 +15,18 @@ export class SeedPhraseComponent implements OnInit, OnDestroy {
|
|||
queryRouting;
|
||||
seedPhrase = '';
|
||||
wallet_id: number;
|
||||
seedPhraseCopied = false;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private location: Location,
|
||||
private backend: BackendService,
|
||||
private variablesService: VariablesService,
|
||||
public variablesService: VariablesService,
|
||||
private modalService: ModalService,
|
||||
private ngZone: NgZone
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.queryRouting = this.route.queryParams.subscribe(params => {
|
||||
|
|
@ -65,8 +67,7 @@ export class SeedPhraseComponent implements OnInit, OnDestroy {
|
|||
} else {
|
||||
this.variablesService.opening_wallet = null;
|
||||
this.modalService.prepareModal('error', 'OPEN_WALLET.WITH_ADDRESS_ALREADY_OPEN');
|
||||
this.backend.closeWallet(this.wallet_id, (close_status, close_data) => {
|
||||
console.log(close_status, close_data);
|
||||
this.backend.closeWallet(this.wallet_id, () => {
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(['/']);
|
||||
});
|
||||
|
|
@ -74,6 +75,14 @@ export class SeedPhraseComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
copySeedPhrase() {
|
||||
this.backend.setClipboard(this.seedPhrase, () => {
|
||||
this.ngZone.run(() => {
|
||||
this.seedPhraseCopied = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
back() {
|
||||
this.location.back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<form class="form-send" [formGroup]="sendForm" (ngSubmit)="onSend()">
|
||||
|
||||
<div class="input-block input-block-address">
|
||||
<div class="input-block input-block-alias">
|
||||
<label for="send-address">{{ 'SEND.ADDRESS' | translate }}</label>
|
||||
|
||||
<input type="text" id="send-address" formControlName="address" (mousedown)="addressMouseDown($event)" (contextmenu)="variablesService.onContextMenu($event)">
|
||||
|
||||
<div class="address-dropdown scrolled-content" *ngIf="isOpen">
|
||||
<div class="alias-dropdown scrolled-content" *ngIf="isOpen">
|
||||
<div *ngFor="let item of localAliases" (click)="setAlias(item.name)">{{item.name}}</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -39,7 +39,10 @@
|
|||
|
||||
<div class="input-block">
|
||||
<label for="send-comment">{{ 'SEND.COMMENT' | translate }}</label>
|
||||
<input type="text" id="send-comment" formControlName="comment" (contextmenu)="variablesService.onContextMenu($event)">
|
||||
<input type="text" id="send-comment" formControlName="comment" [maxLength]="variablesService.maxCommentLength" (contextmenu)="variablesService.onContextMenu($event)">
|
||||
<div class="error-block" *ngIf="sendForm.get('comment').value && sendForm.get('comment').value.length >= variablesService.maxCommentLength">
|
||||
{{ 'SEND.FORM_ERRORS.MAX_LENGTH' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,23 +4,6 @@
|
|||
|
||||
.form-send {
|
||||
|
||||
.input-block-address {
|
||||
position: relative;
|
||||
|
||||
.address-dropdown {
|
||||
position: absolute;
|
||||
top: 6.5rem;
|
||||
max-height: 10rem;
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
|
||||
div {
|
||||
font-size: 1.4rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-blocks-row {
|
||||
display: flex;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,13 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
return null;
|
||||
}]),
|
||||
comment: new FormControl(null),
|
||||
comment: new FormControl('', [(g: FormControl) => {
|
||||
if (g.value > this.variablesService.maxCommentLength) {
|
||||
return {'maxLength': true};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}]),
|
||||
mixin: new FormControl(0, Validators.required),
|
||||
fee: new FormControl(this.variablesService.default_fee, [Validators.required, (g: FormControl) => {
|
||||
if ((new BigNumber(g.value)).isLessThan(this.variablesService.default_fee)) {
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@
|
|||
<span class="balance">{{wallet.balance | intToMoney : '3' }} {{variablesService.defaultCurrency}}</span>
|
||||
</div>
|
||||
<div class="sidebar-account-row account-alias">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span>{{wallet.alias['name']}}</span>
|
||||
<div class="name">
|
||||
<span tooltip="{{wallet.alias['name']}}" placement="top-left" tooltipClass="table-tooltip account-tooltip" [delay]="500" [showWhenNoOverflow]="false">{{wallet.alias['name']}}</span>
|
||||
<ng-container *ngIf="wallet.alias['comment'] && wallet.alias['comment'].length">
|
||||
<i class="icon comment" tooltip="{{wallet.alias['comment']}}" placement="top" tooltipClass="table-tooltip account-tooltip" [delay]="500"></i>
|
||||
</ng-container>
|
||||
</div>
|
||||
<span>$ {{wallet.getMoneyEquivalent(variablesService.moneyEquivalent) | intToMoney | number : '1.2-2'}}</span>
|
||||
<span class="price">$ {{wallet.getMoneyEquivalent(variablesService.moneyEquivalent) | intToMoney | number : '1.2-2'}}</span>
|
||||
</div>
|
||||
<div class="sidebar-account-row account-staking" *ngIf="!(!wallet.loaded && variablesService.daemon_state === 2)">
|
||||
<span class="text">{{ 'SIDEBAR.ACCOUNT.STAKING' | translate }}</span>
|
||||
|
|
|
|||
|
|
@ -72,6 +72,25 @@
|
|||
line-height: 3.4rem;
|
||||
margin-bottom: 0.7rem;
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 1;
|
||||
line-height: 1.6rem;
|
||||
padding-right: 1rem;
|
||||
overflow: hidden;
|
||||
|
||||
span {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-left: 0.5rem;
|
||||
width: 1.2rem;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@
|
|||
},
|
||||
"SEED_PHRASE": {
|
||||
"TITLE": "Make sure to keep your seed phrase in a safe place. If you forget your seed phrase you will not be able to recover your wallet.",
|
||||
"BUTTON_CREATE_ACCOUNT" : "Create wallet"
|
||||
"BUTTON_CREATE_ACCOUNT" : "Create wallet",
|
||||
"BUTTON_COPY" : "Copy"
|
||||
},
|
||||
"PROGRESS": {
|
||||
"ADD_WALLET": "Add wallet",
|
||||
|
|
@ -257,13 +258,14 @@
|
|||
"AMOUNT_REQUIRED": "Amount is required.",
|
||||
"AMOUNT_ZERO": "Amount is zero.",
|
||||
"FEE_REQUIRED": "Fee is required.",
|
||||
"FEE_MINIMUM": "Minimum fee: {{fee}}"
|
||||
"FEE_MINIMUM": "Minimum fee: {{fee}}",
|
||||
"MAX_LENGTH": "Maximum comment length reached."
|
||||
}
|
||||
},
|
||||
"HISTORY": {
|
||||
"STATUS": "Status",
|
||||
"STATUS_TOOLTIP": "Confirmations {{current}}/{{total}}",
|
||||
"SEND": "Send",
|
||||
"SEND": "Sent",
|
||||
"RECEIVED": "Received",
|
||||
"DATE": "Date",
|
||||
"AMOUNT": "Amount",
|
||||
|
|
@ -374,6 +376,7 @@
|
|||
"DESC_MAXIMUM": "Maximum field length reached.",
|
||||
"SELLER_REQUIRED": "Seller is required.",
|
||||
"SELLER_NOT_VALID": "Seller not valid.",
|
||||
"ALIAS_NOT_VALID": "Alias not valid.",
|
||||
"AMOUNT_REQUIRED": "Amount is required.",
|
||||
"YOUR_DEPOSIT_REQUIRED": "Your deposit is required.",
|
||||
"YOUR_DEPOSIT_TOO_SMALL": "Your deposit should be equal or greater than amount.",
|
||||
|
|
@ -472,7 +475,7 @@
|
|||
"NO_MONEY": "Not enough money",
|
||||
"NOT_ENOUGH_MONEY": "Insufficient funds in account",
|
||||
"CORE_BUSY": "Internal error (core is busy)",
|
||||
"DAEMON_BUSY": "Internal error: deamon is busy",
|
||||
"DAEMON_BUSY": "Internal error: daemon is busy",
|
||||
"NO_MONEY_REMOVE_OFFER": "There is no fee for deleting an offer, but in order to protect the network against flood transactions you need to have at least {{fee}} {{currency}} in your wallet",
|
||||
"NOT_ENOUGH_OUTPUTS_TO_MIX": "Mix-in number is too big for current blockchain state. There are not enough unspent outputs to mix with",
|
||||
"TRANSACTION_IS_TO_BIG": "Transaction exceeds network limit, send required amount with multiple transactions",
|
||||
|
|
|
|||
|
|
@ -566,6 +566,13 @@ input[type='checkbox'].style-checkbox {
|
|||
max-width: 18rem;
|
||||
}
|
||||
|
||||
.comment-tooltip {
|
||||
overflow: auto;
|
||||
word-break: break-word;
|
||||
max-width: 50rem;
|
||||
max-height: 25rem;
|
||||
}
|
||||
|
||||
.ngx-contextmenu {
|
||||
|
||||
.dropdown-menu {
|
||||
|
|
@ -625,6 +632,10 @@ input[type='checkbox'].style-checkbox {
|
|||
|
||||
.ng-value-container {
|
||||
padding: 0;
|
||||
|
||||
.ng-input {
|
||||
top: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,24 +99,6 @@ app-send {
|
|||
|
||||
.form-send {
|
||||
|
||||
.input-block-address {
|
||||
|
||||
.address-dropdown {
|
||||
|
||||
@include themify($themes) {
|
||||
background-color: themed(inputBackgroundColor);
|
||||
color: themed(mainTextColor);
|
||||
}
|
||||
|
||||
|
||||
div:hover {
|
||||
@include themify($themes) {
|
||||
background-color: themed(selectHoverColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.send-select {
|
||||
|
||||
@include themify($themes) {
|
||||
|
|
@ -449,3 +431,31 @@ app-staking {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-block-alias {
|
||||
position: relative;
|
||||
|
||||
.alias-dropdown {
|
||||
position: absolute;
|
||||
top: 6.5rem;
|
||||
max-height: 10rem;
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
|
||||
@include themify($themes) {
|
||||
background-color: themed(inputBackgroundColor);
|
||||
color: themed(mainTextColor);
|
||||
}
|
||||
|
||||
div {
|
||||
font-size: 1.4rem;
|
||||
padding: 1rem;
|
||||
|
||||
&:hover {
|
||||
@include themify($themes) {
|
||||
background-color: themed(selectHoverColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -914,7 +914,6 @@ bool simple_wallet::get_transfer_info(const std::vector<std::string> &args)
|
|||
{
|
||||
fail_msg_writer() << "failed to find transfer info by key_image";
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
std::string json_details = epee::serialization::store_t_to_json(td);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
#define BUILD_COMMIT_ID "@VERSION@"
|
||||
#define PROJECT_VERSION "1.0"
|
||||
#define PROJECT_VERSION_BUILD_NO 16
|
||||
#define PROJECT_VERSION_BUILD_NO 17
|
||||
#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 "]"
|
||||
|
|
|
|||
|
|
@ -1468,7 +1468,7 @@ bool wallet2::scan_unconfirmed_outdate_tx()
|
|||
bool tx_outdated = it->second.timestamp < time_limit;
|
||||
if (tx_outdated || is_tx_expired(it->second.tx, tx_expiration_ts_median))
|
||||
{
|
||||
WLT_LOG_BLUE("removing unconfirmed tx " << it->second.tx_hash << ", reason: " << (tx_outdated ? "outdated" : "expired"), LOG_LEVEL_0);
|
||||
WLT_LOG_BLUE("removing unconfirmed tx " << it->second.tx_hash << ", reason: " << (tx_outdated ? "outdated" : "expired") << ", tx_expiration_ts_median=" << tx_expiration_ts_median, LOG_LEVEL_0);
|
||||
//lookup all used transfer and update flags
|
||||
for (auto i : it->second.selected_indicies)
|
||||
{
|
||||
|
|
@ -1649,6 +1649,7 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
WLT_LOG_L0("Detaching blockchain on height " << height);
|
||||
size_t transfers_detached = 0;
|
||||
|
||||
// rollback incoming transfers from detaching subchain
|
||||
{
|
||||
auto it = std::find_if(m_transfers.begin(), m_transfers.end(), [&](const transfer_details& td){return td.m_ptx_wallet_info->m_block_height >= height; });
|
||||
if (it != m_transfers.end())
|
||||
|
|
@ -1658,7 +1659,8 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
for (size_t i = i_start; i != m_transfers.size(); i++)
|
||||
{
|
||||
auto it_ki = m_key_images.find(m_transfers[i].m_key_image);
|
||||
THROW_IF_TRUE_WALLET_EX(it_ki == m_key_images.end(), error::wallet_internal_error, "key image not found");
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(it_ki != m_key_images.end(), "key image " << m_transfers[i].m_key_image << " not found");
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(m_transfers[i].m_ptx_wallet_info->m_block_height >= height, "transfer #" << i << " block height is less than " << height);
|
||||
m_key_images.erase(it_ki);
|
||||
++transfers_detached;
|
||||
}
|
||||
|
|
@ -1671,14 +1673,14 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
m_local_bc_height -= blocks_detached;
|
||||
|
||||
//rollback spends
|
||||
// do not clear spent flag in spent transfers as corresponding txs are most likely in the pool
|
||||
// they will be moved into m_unconfirmed_txs for clearing in future (if tx will expire of removed from pool)
|
||||
for (size_t i = 0, sz = m_transfers.size(); i < sz; ++i)
|
||||
{
|
||||
auto& tr = m_transfers[i];
|
||||
if (tr.m_spent_height >= height)
|
||||
{
|
||||
uint32_t flags_before = tr.m_flags;
|
||||
tr.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
WLT_LOG_BLUE("Transfer [" << i << "] marked as unspent, flags: " << flags_before << " -> " << tr.m_flags << ", reason: blockchain detach height " << height << " is lower or equal to transfer spent height " << tr.m_spent_height, LOG_LEVEL_1);
|
||||
WLT_LOG_BLUE("Transfer [" << i << "] spent height: " << tr.m_spent_height << " -> 0, reason: detaching blockchain", LOG_LEVEL_1);
|
||||
tr.m_spent_height = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1691,8 +1693,28 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
break;
|
||||
tr_hist_it = it; // note that tr_hist_it->height >= height
|
||||
}
|
||||
|
||||
if (tr_hist_it != m_transfer_history.rend())
|
||||
m_transfer_history.erase(--tr_hist_it.base(), m_transfer_history.end());
|
||||
{
|
||||
auto it_from = --tr_hist_it.base();
|
||||
// before removing wti from m_transfer_history put it into m_unconfirmed_txs as txs from detached blocks are most likely be moved into the pool
|
||||
for (auto it = it_from; it != m_transfer_history.end(); ++it)
|
||||
{
|
||||
// skip coinbase txs as they are not expected to go into the pool
|
||||
if (is_coinbase(it->tx))
|
||||
{
|
||||
if (!it->is_mining)
|
||||
WLT_LOG_ERROR("is_mining flag is not consistent for tx " << it ->tx_hash);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!m_unconfirmed_txs.insert(std::make_pair(it->tx_hash, *it)).second)
|
||||
{
|
||||
WLT_LOG_ERROR("can't move wti from transfer history to unronfirmed txs because such it is already here, tx hash: " << it->tx_hash);
|
||||
}
|
||||
}
|
||||
m_transfer_history.erase(it_from, m_transfer_history.end());
|
||||
}
|
||||
|
||||
//rollback payments
|
||||
for (auto it = m_payments.begin(); it != m_payments.end(); )
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
size_t small_outs_to_transfer = MAX_ALIAS_PER_BLOCK + 10;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TX_DEFAULT_FEE * 11, small_outs_to_transfer, TX_DEFAULT_FEE, tx_1);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TESTS_DEFAULT_FEE * 11, small_outs_to_transfer, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1); // 4N+4
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_a, blk_0r, miner_account, tx_1); // 4N+5
|
||||
|
|
@ -398,7 +398,7 @@ bool gen_alias_tests::check_too_many_aliases_registration(currency::core& c, siz
|
|||
ai.m_address = someone.get_public_address();
|
||||
ai.m_alias = gen_random_alias(random_in_range(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED + 20));
|
||||
transaction alias_reg_tx = AUTO_VAL_INIT(alias_reg_tx);
|
||||
miner_wlt->request_alias_registration(ai, alias_reg_tx, TX_DEFAULT_FEE, estimated_alias_cost);
|
||||
miner_wlt->request_alias_registration(ai, alias_reg_tx, TESTS_DEFAULT_FEE, estimated_alias_cost);
|
||||
|
||||
b.tx_hashes.push_back(get_transaction_hash(alias_reg_tx)); // add this tx to block template
|
||||
}
|
||||
|
|
@ -815,7 +815,7 @@ bool gen_alias_blocking_reg_by_invalid_tx::generate(std::vector<test_event_entry
|
|||
ai.m_address = attacker.get_public_address();
|
||||
ai.m_sign.push_back(invalid_signature); // it's an invalid sign, so effectivly it's an update alias request
|
||||
std::vector<currency::extra_v> ex(1, ai);
|
||||
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, attacker, attacker, TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, blk_1, CURRENCY_TO_KEY_OUT_RELAXED, ex, false);
|
||||
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, attacker, attacker, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, blk_1, CURRENCY_TO_KEY_OUT_RELAXED, ex, false);
|
||||
|
||||
// No one can't include this tx into a block
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -1061,7 +1061,7 @@ bool gen_alias_too_small_reward::generate(std::vector<test_event_entry>& events)
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TX_DEFAULT_FEE * 100, 3 * aliases_count, TX_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TESTS_DEFAULT_FEE * 100, 3 * aliases_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -1074,12 +1074,12 @@ bool gen_alias_too_small_reward::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // should be rejected, because it's paid TX_POOL_MINIMUM_FEE / 10
|
||||
if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, TX_DEFAULT_FEE / 10, miner_acc, tx, used_sources))
|
||||
if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, ALIAS_VERY_INITAL_COAST / 10, miner_acc, tx, used_sources))
|
||||
return false;
|
||||
|
||||
// this block commented due to new fee median rules, TODO: review
|
||||
// DO_CALLBACK(events, "mark_invalid_tx"); // should be rejected, because it's paid TX_POOL_MINIMUM_FEE / 10 less then required
|
||||
// if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, alias_reward - TX_DEFAULT_FEE / 10, miner_acc, tx, used_sources))
|
||||
// if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, alias_reward - TESTS_DEFAULT_FEE / 10, miner_acc, tx, used_sources))
|
||||
// return false;
|
||||
|
||||
// should be accepted
|
||||
|
|
@ -1265,7 +1265,7 @@ bool gen_alias_switch_and_check_block_template::generate(std::vector<test_event_
|
|||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
std::vector<currency::extra_v> extra(1, ai);
|
||||
|
||||
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, miner_acc, miner_acc, 1, TX_DEFAULT_FEE, 0, blk_2, CURRENCY_TO_KEY_OUT_RELAXED, extra, true); // 2N+6
|
||||
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, miner_acc, miner_acc, 1, TESTS_DEFAULT_FEE, 0, blk_2, CURRENCY_TO_KEY_OUT_RELAXED, extra, true); // 2N+6
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_0); // 2N+7
|
||||
|
||||
// split the chain
|
||||
|
|
@ -1344,10 +1344,10 @@ bool gen_alias_too_many_regs_in_block_template::generate(std::vector<test_event_
|
|||
uint64_t total_alias_cost = 0;
|
||||
for(size_t i = 0; i < m_total_alias_to_gen; ++i)
|
||||
{
|
||||
destinations.push_back(tx_destination_entry(m_estimated_alias_cost + TX_DEFAULT_FEE, alice_acc.get_public_address()));
|
||||
total_alias_cost += m_estimated_alias_cost + TX_DEFAULT_FEE;
|
||||
destinations.push_back(tx_destination_entry(m_estimated_alias_cost + TESTS_DEFAULT_FEE, alice_acc.get_public_address()));
|
||||
total_alias_cost += m_estimated_alias_cost + TESTS_DEFAULT_FEE;
|
||||
}
|
||||
total_alias_cost += TX_DEFAULT_FEE;
|
||||
total_alias_cost += TESTS_DEFAULT_FEE;
|
||||
r = fill_tx_sources(sources, events, blk_0r, preminer_acc.get_keys(), total_alias_cost, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
uint64_t sources_amount = get_sources_total_amount(sources);
|
||||
|
|
@ -1390,7 +1390,7 @@ bool gen_alias_too_many_regs_in_block_template::add_block_from_template(currency
|
|||
ai.m_address = someone.get_public_address();
|
||||
ai.m_alias = gen_random_alias(random_in_range(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED + 20));
|
||||
transaction alias_reg_tx = AUTO_VAL_INIT(alias_reg_tx);
|
||||
alice_wlt->request_alias_registration(ai, alias_reg_tx, TX_DEFAULT_FEE, m_estimated_alias_cost);
|
||||
alice_wlt->request_alias_registration(ai, alias_reg_tx, TESTS_DEFAULT_FEE, m_estimated_alias_cost);
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
|
|
@ -1450,13 +1450,13 @@ bool gen_alias_update_for_free::generate(std::vector<test_event_entry>& events)
|
|||
// create a tx with chargeback, paying only the minimum required fee
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), TX_DEFAULT_FEE, 0, true, true);
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), TESTS_DEFAULT_FEE, 0, true, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
uint64_t input_amount = 0;
|
||||
for (auto se : sources)
|
||||
input_amount += se.amount;
|
||||
if (input_amount > TX_DEFAULT_FEE)
|
||||
destinations.push_back(tx_destination_entry(input_amount - TX_DEFAULT_FEE, miner_acc.get_public_address()));
|
||||
if (input_amount > TESTS_DEFAULT_FEE)
|
||||
destinations.push_back(tx_destination_entry(input_amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()));
|
||||
|
||||
tx_builder tb;
|
||||
tb.step1_init();
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ bool block_template_against_txs_size::c1(currency::core& c, size_t ev_index, con
|
|||
uint64_t base_block_reward_pow = get_base_block_reward(false, bcs.total_coins(), top_block_height + 1);
|
||||
uint64_t base_block_reward_pos = get_base_block_reward(true, bcs.total_coins(), top_block_height + 1);
|
||||
|
||||
g_block_txs_fee = TX_DEFAULT_FEE; // passing an argument to custom_fill_block_template_func via global variable (not perfect but works well)
|
||||
g_block_txs_fee = TESTS_DEFAULT_FEE; // passing an argument to custom_fill_block_template_func via global variable (not perfect but works well)
|
||||
|
||||
CHECK_AND_ASSERT_MES(blocksize_limit > CURRENCY_COINBASE_BLOB_RESERVED_SIZE, false, "internal invariant failed");
|
||||
|
||||
|
|
|
|||
|
|
@ -249,13 +249,13 @@ bool bad_chain_switching_with_rollback::generate(std::vector<test_event_entry>&
|
|||
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, test_core_time::get_time());
|
||||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
|
||||
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, TX_DEFAULT_FEE * 2, blk_0r);
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, TESTS_DEFAULT_FEE * 2, blk_0r);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
||||
MAKE_NEXT_BLOCK(events, blk_2, blk_1, miner_acc);
|
||||
|
||||
// make tx_2 referring to tx_1 output
|
||||
MAKE_TX(events, tx_2, alice_acc, bob_acc, TX_DEFAULT_FEE, blk_2);
|
||||
MAKE_TX(events, tx_2, alice_acc, bob_acc, TESTS_DEFAULT_FEE, blk_2);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_2);
|
||||
|
||||
// check balance at gentime
|
||||
|
|
@ -267,12 +267,12 @@ bool bad_chain_switching_with_rollback::generate(std::vector<test_event_entry>&
|
|||
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", 0, 0, 0, 0, 0), false, "");
|
||||
|
||||
// Bob should have TX_DEFAULT_FEE
|
||||
// Bob should have TESTS_DEFAULT_FEE
|
||||
std::shared_ptr<tools::wallet2> bob_wlt;
|
||||
generator.init_test_wallet(bob_acc, get_block_hash(blk_0), bob_wlt);
|
||||
r = generator.refresh_test_wallet(events, bob_wlt.get(), get_block_hash(blk_3), CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4 + 3);
|
||||
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", TX_DEFAULT_FEE, 0, 0, 0, 0), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", TESTS_DEFAULT_FEE, 0, 0, 0, 0), false, "");
|
||||
|
||||
// start altchain from blk_0r, include tx_2 but NOT include tx_1
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -355,8 +355,8 @@ bool chain_switching_and_tx_with_attachment_blobsize::generate(std::vector<test_
|
|||
std::vector<attachment_v> attachment({comment_att});
|
||||
|
||||
// create txs with attachment (and put it in the pool)
|
||||
MAKE_TX_ATTACH(events, tx_1, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_2, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_1, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
|
||||
// make sure the pool has correct txs
|
||||
DO_CALLBACK_PARAMS_STR(events, "check_tx_pool_txs", epee::serialization::store_t_to_json(params_tx_pool(get_transaction_hash(tx_1), get_object_blobsize(tx_1), get_transaction_hash(tx_2), get_object_blobsize(tx_2))));
|
||||
|
|
@ -477,7 +477,7 @@ bool alt_chain_coins_pow_mined_then_spent::generate(std::vector<test_event_entry
|
|||
// +-------------tx_1 tx_1 spents 2a.miner_tx output
|
||||
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // simulate alt-block tx behaviour
|
||||
MAKE_TX(events, tx_1, alice_acc, alice_acc, TX_DEFAULT_FEE, blk_2ra);
|
||||
MAKE_TX(events, tx_1, alice_acc, alice_acc, TESTS_DEFAULT_FEE, blk_2ra);
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, false));
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3a, blk_2ra, miner_acc, tx_1);
|
||||
|
|
@ -516,7 +516,7 @@ bool alt_blocks_validation_and_same_new_amount_in_two_txs::generate(std::vector<
|
|||
|
||||
// make two txs with one output (huge fee, probably - doesn't matter) with amount that is never seen before
|
||||
std::vector<tx_source_entry> sources;
|
||||
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TX_DEFAULT_FEE, 0);
|
||||
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
destinations.push_back(tx_destination_entry(new_amount, miner_acc.get_public_address())); // no cashback, just payment
|
||||
|
|
@ -527,7 +527,7 @@ bool alt_blocks_validation_and_same_new_amount_in_two_txs::generate(std::vector<
|
|||
|
||||
// second tx
|
||||
sources.clear();
|
||||
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TX_DEFAULT_FEE, 0, sources);
|
||||
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TESTS_DEFAULT_FEE, 0, sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
// use the same destinations
|
||||
|
|
@ -577,7 +577,7 @@ bool alt_blocks_with_the_same_txs::generate(std::vector<test_event_entry>& event
|
|||
// \- (2a)- (3a)- (4 )-
|
||||
// tx_0
|
||||
|
||||
MAKE_TX(events, tx_0, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_1r);
|
||||
MAKE_TX(events, tx_0, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_1r);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_0);
|
||||
MAKE_NEXT_BLOCK(events, blk_3, blk_2, miner_acc);
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ bool gen_chain_switch_pow_pos::generate(std::vector<test_event_entry>& events) c
|
|||
|
||||
uint64_t buttloads_of_money = currency::get_outs_money_amount(blk_0.miner_tx);
|
||||
m_premine_amount = buttloads_of_money;
|
||||
MAKE_TX_FEE(events, tx_1, miner_acc, alice, buttloads_of_money - TX_DEFAULT_FEE, TX_DEFAULT_FEE, blk_0r); // N+5
|
||||
buttloads_of_money -= TX_DEFAULT_FEE;
|
||||
MAKE_TX_FEE(events, tx_1, miner_acc, alice, buttloads_of_money - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, blk_0r); // N+5
|
||||
buttloads_of_money -= TESTS_DEFAULT_FEE;
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1); // N+6
|
||||
|
||||
|
|
|
|||
|
|
@ -887,7 +887,7 @@ bool test_generator::construct_pow_block_with_alias_info_in_coinbase(const accou
|
|||
if (ai.m_sign.empty())
|
||||
{
|
||||
// if no alias update - reduce block reward by alias cost
|
||||
uint64_t alias_cost = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
|
||||
uint64_t alias_cost = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
|
||||
uint64_t block_reward = get_outs_money_amount(miner_tx);
|
||||
CHECK_AND_ASSERT_MES(alias_cost <= block_reward, false, "Alias '" << ai.m_alias << "' can't be registered via block coinbase, because it's price: " << print_money(alias_cost) << " is greater than block reward: " << print_money(block_reward));
|
||||
block_reward -= alias_cost;
|
||||
|
|
@ -1251,9 +1251,9 @@ bool fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
|
|||
uint64_t source_amount_found = 0;
|
||||
bool r = fill_tx_sources(sources, events, blk_head, from, amount + fee, nmix, std::vector<currency::tx_source_entry>(), check_for_spends, check_for_unlocktime, use_ref_by_id, &source_amount_found);
|
||||
CHECK_AND_ASSERT_MES(r, false, "couldn't fill transaction sources: " << ENDL <<
|
||||
" required: " << print_money(amount + fee) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee) / TX_DEFAULT_FEE) << " x TX_DEFAULT_FEE" << ENDL <<
|
||||
" unspent coins: " << print_money(source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * source_amount_found / TX_DEFAULT_FEE) << " x TX_DEFAULT_FEE" << ENDL <<
|
||||
" lack of coins: " << print_money(amount + fee - source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee - source_amount_found) / TX_DEFAULT_FEE) << " x TX_DEFAULT_FEE"
|
||||
" required: " << print_money(amount + fee) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee) / TESTS_DEFAULT_FEE) << " x TESTS_DEFAULT_FEE" << ENDL <<
|
||||
" unspent coins: " << print_money(source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * source_amount_found / TESTS_DEFAULT_FEE) << " x TESTS_DEFAULT_FEE" << ENDL <<
|
||||
" lack of coins: " << print_money(amount + fee - source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee - source_amount_found) / TESTS_DEFAULT_FEE) << " x TESTS_DEFAULT_FEE"
|
||||
);
|
||||
|
||||
uint64_t inputs_amount = get_inputs_amount(sources);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "chaingen_helpers.h"
|
||||
|
||||
#define TESTS_DEFAULT_FEE ((uint64_t)TX_DEFAULT_FEE)
|
||||
#define MK_TEST_COINS(amount) (static_cast<uint64_t>(amount) * TESTS_DEFAULT_FEE)
|
||||
#define MK_TEST_COINS(amount) (static_cast<uint64_t>(amount) * TX_DEFAULT_FEE)
|
||||
#define TESTS_POS_CONFIG_MIN_COINSTAKE_AGE 4
|
||||
#define TESTS_POS_CONFIG_POS_MINIMUM_HEIGH 4
|
||||
|
||||
|
|
@ -553,7 +553,7 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
uint64_t fee = TX_DEFAULT_FEE,
|
||||
uint64_t fee = TESTS_DEFAULT_FEE,
|
||||
size_t nmix = 0,
|
||||
uint8_t mix_attr = CURRENCY_TO_KEY_OUT_RELAXED,
|
||||
const std::vector<currency::extra_v>& extr = empty_extra,
|
||||
|
|
@ -622,7 +622,7 @@ bool make_tx_multisig_to_key(const currency::transaction& source_tx,
|
|||
const std::list<currency::account_keys>& participants,
|
||||
const currency::account_public_address& target_address,
|
||||
currency::transaction& tx,
|
||||
uint64_t fee = TX_DEFAULT_FEE,
|
||||
uint64_t fee = TESTS_DEFAULT_FEE,
|
||||
const std::vector<currency::attachment_v>& attachments = empty_attachment,
|
||||
const std::vector<currency::extra_v>& extra = empty_extra);
|
||||
|
||||
|
|
@ -1124,7 +1124,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
|
||||
{ \
|
||||
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(MONEY, DEST_ACC.get_public_address())); \
|
||||
WLT_WAR->transfer(destinations, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), TX_VAR); \
|
||||
WLT_WAR->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), TX_VAR); \
|
||||
} \
|
||||
EVENTS_VEC.push_back(TX_VAR)
|
||||
|
||||
|
|
@ -1132,7 +1132,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
|
||||
{ \
|
||||
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(MONEY, DEST_ACC.get_public_address())); \
|
||||
WLT_WAR->transfer(destinations, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), ATTACH, TX_VAR); \
|
||||
WLT_WAR->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), ATTACH, TX_VAR); \
|
||||
} \
|
||||
EVENTS_VEC.push_back(TX_VAR)
|
||||
|
||||
|
|
@ -1140,7 +1140,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
|
||||
{ \
|
||||
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(MONEY, DEST_ACC.get_public_address())); \
|
||||
WLT_WAR->transfer(destinations, 0, 0, TX_DEFAULT_FEE, EXTRA, std::vector<attachment_v>(), TX_VAR); \
|
||||
WLT_WAR->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, EXTRA, std::vector<attachment_v>(), TX_VAR); \
|
||||
} \
|
||||
EVENTS_VEC.push_back(TX_VAR)
|
||||
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
GENERATE_AND_PLAY(wallet_rpc_integrated_address);
|
||||
GENERATE_AND_PLAY(wallet_rpc_integrated_address_transfer);
|
||||
|
||||
GENERATE_AND_PLAY(wallet_chain_switch_with_spending_the_same_ki);
|
||||
|
||||
// GENERATE_AND_PLAY(emission_test); // simulate 1 year of blockchain, too long run (1 y ~= 1 hr), by demand only
|
||||
// LOG_ERROR2("print_reward_change_first_blocks.log", currency::print_reward_change_first_blocks(525601).str()); // outputs first 1 year of blocks' rewards (simplier)
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ bool gen_checkpoints_invalid_keyimage::generate(std::vector<test_event_entry>& e
|
|||
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
bool r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, miner_acc, MK_TEST_COINS(1), TX_DEFAULT_FEE, 0, sources, destinations);
|
||||
bool r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, miner_acc, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
tx_builder tb;
|
||||
tb.step1_init();
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ bool pos_emission_test::generate(std::vector<test_event_entry> &events)
|
|||
m_total_money_in_minting = m_pos_entries_to_generate * pos_entry_amount;
|
||||
|
||||
std::vector<tx_source_entry> sources;
|
||||
bool r = fill_tx_sources(sources, events, blk_0r, preminer_acc.get_keys(), m_total_money_in_minting + TX_DEFAULT_FEE, 0);
|
||||
bool r = fill_tx_sources(sources, events, blk_0r, preminer_acc.get_keys(), m_total_money_in_minting + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
for (size_t i = 0; i < m_pos_entries_to_generate; ++i)
|
||||
|
|
@ -271,7 +271,7 @@ bool pos_emission_test::c1(currency::core& c, size_t ev_index, const std::vector
|
|||
{
|
||||
uint64_t amount = std::min(wallet_balance_unlocked, wallet_balance - m_total_money_in_minting);
|
||||
size_t tx_count_before = c.get_pool_transactions_count();
|
||||
alice_wlt->transfer(amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out excess of money
|
||||
alice_wlt->transfer(amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out excess of money
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() > tx_count_before, false, "invalid number of txs in tx pool: " << c.get_pool_transactions_count());
|
||||
}
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ bool pos_emission_test::populate_wallet_with_pos_entries(std::shared_ptr<tools::
|
|||
uint64_t total_stake_transferred = m_pos_entries_to_generate * m_pos_entry_amount;
|
||||
CHECK_AND_ASSERT_MES(total_stake_transferred <= m_total_money_in_minting, false, "total_stake_transferred: " << total_stake_transferred << ", m_total_money_in_minting: " << m_total_money_in_minting);
|
||||
uint64_t remainder = m_total_money_in_minting - total_stake_transferred;
|
||||
if (remainder > TX_DEFAULT_FEE)
|
||||
if (remainder > TESTS_DEFAULT_FEE)
|
||||
coin_source->transfer(remainder, w->get_account().get_public_address());
|
||||
|
||||
return true;
|
||||
|
|
@ -525,8 +525,8 @@ bool pos_emission_test::c3(currency::core& c, size_t ev_index, const std::vector
|
|||
uint64_t unlocked_balance = 0;
|
||||
uint64_t total_balance = current_wallet->balance(unlocked_balance);
|
||||
CHECK_AND_ASSERT_MES(unlocked_balance == total_balance, false, "Total and unlocked balances don't equal: " << unlocked_balance << " != " << total_balance);
|
||||
if (unlocked_balance > TX_DEFAULT_FEE)
|
||||
current_wallet->transfer(unlocked_balance - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out all the money to Miner -- clear pos entries
|
||||
if (unlocked_balance > TESTS_DEFAULT_FEE)
|
||||
current_wallet->transfer(unlocked_balance - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out all the money to Miner -- clear pos entries
|
||||
|
||||
r = populate_wallet_with_pos_entries(current_wallet, dan_wlt, change_pos_entries_iter_index++, pos_entries_change_scheme::change_pos_entries_count);
|
||||
CHECK_AND_ASSERT_MES(r, false, "populate_wallet_with_pos_entries failed");
|
||||
|
|
|
|||
|
|
@ -318,6 +318,7 @@ bool escrow_altchain_meta_impl::c1(currency::core& c, size_t ev_index, const std
|
|||
size_t blocks_fetched = 0;
|
||||
alice_wlt->refresh(blocks_fetched);
|
||||
CHECK_AND_ASSERT_MES(blocks_fetched == se.expected_blocks, false, "Alice got " << blocks_fetched << " after refresh, but " << se.expected_blocks << " is expected");
|
||||
LOG_PRINT_GREEN("Alice's transfers:" << ENDL << alice_wlt->dump_trunsfers(), LOG_LEVEL_1);
|
||||
if (se.a_balance != UINT64_MAX)
|
||||
{
|
||||
uint64_t alice_balance = alice_wlt->balance();
|
||||
|
|
@ -329,13 +330,13 @@ bool escrow_altchain_meta_impl::c1(currency::core& c, size_t ev_index, const std
|
|||
alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(check_contract_state(contracts, m_etd.cpd, static_cast<tools::wallet_rpc::escrow_contract_details_basic::contract_state>(se.a_state), "Alice"), false, "");
|
||||
}
|
||||
LOG_PRINT_GREEN("Alice's transfers:" << ENDL << alice_wlt->dump_trunsfers(), LOG_LEVEL_1);
|
||||
|
||||
LOG_PRINT_GREEN("Bob's wallet is refreshing...", LOG_LEVEL_1);
|
||||
bob_wlt->scan_tx_pool(stub);
|
||||
blocks_fetched = 0;
|
||||
bob_wlt->refresh(blocks_fetched);
|
||||
CHECK_AND_ASSERT_MES(blocks_fetched == se.expected_blocks, false, "Bob got " << blocks_fetched << " after refresh, but " << se.expected_blocks << " is expected");
|
||||
LOG_PRINT_GREEN("Bob's transfers:" << ENDL << bob_wlt->dump_trunsfers(), LOG_LEVEL_1);
|
||||
if (se.b_balance != UINT64_MAX)
|
||||
{
|
||||
uint64_t bob_balance = bob_wlt->balance();
|
||||
|
|
@ -347,7 +348,6 @@ bool escrow_altchain_meta_impl::c1(currency::core& c, size_t ev_index, const std
|
|||
bob_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(check_contract_state(contracts, m_etd.cpd, static_cast<tools::wallet_rpc::escrow_contract_details_basic::contract_state>(se.b_state), "Bob"), false, "");
|
||||
}
|
||||
LOG_PRINT_GREEN("Bob's transfers:" << ENDL << bob_wlt->dump_trunsfers(), LOG_LEVEL_1);
|
||||
|
||||
mine_empty_block = true;
|
||||
}
|
||||
|
|
@ -413,7 +413,7 @@ bool escrow_altchain_meta_impl::c1(currency::core& c, size_t ev_index, const std
|
|||
}
|
||||
}
|
||||
|
||||
// c.get_tx_pool().remove_stuck_transactions(); ?
|
||||
c.get_tx_pool().remove_stuck_transactions();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ struct escrow_altchain_meta_test_data<4>
|
|||
// 30- 31- 32- 33- 34- 35- chain A
|
||||
// p w (a) w | a w p - confirmed proposal, (a) - unconfirmed acceptance, a - confirmed acceptance, w - wallet refresh
|
||||
// | ! ! - block triggered chain switching
|
||||
// \- 34- 35- 36- 37- 38- 39- 40- 41- 42- chain B
|
||||
// \- 34- 35- 36- 37- 38- 39- 50- 51- 52- chain B
|
||||
// w t w w - wallet refresh, t - money transfer
|
||||
eam_test_data_t data = eam_test_data_t(alice_bob_start_amount, 2 /* only two transfer for both */, cpd, {
|
||||
// chain A
|
||||
|
|
@ -353,9 +353,16 @@ struct escrow_altchain_meta_test_data<4>
|
|||
eam_event_t(35, 0, eam_event_refresh_and_check(2, contract_states::contract_accepted, contract_states::contract_accepted, alice_bob_start_amount - a_proposal_fee - cpd.amount_a_pledge - cpd.amount_to_pay, alice_bob_start_amount - b_acceptance_fee - b_release_fee - cpd.amount_b_pledge)), // update 33..34
|
||||
eam_event_t(36, 0, eam_event_go_to("33")), // make block 33 being prev for the next one
|
||||
// chain B
|
||||
eam_event_t(40, 0, eam_event_refresh_and_check(6, eam_contract_state_none, eam_contract_state_none, alice_bob_start_amount - a_proposal_fee, alice_bob_start_amount)), // detach 34..35, update 34..39
|
||||
eam_event_t(41, 0, eam_event_transfer(wallet_test::ALICE_ACC_IDX, wallet_test::BOB_ACC_IDX, alice_bob_start_amount - a_proposal_fee - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE)), // make sure money are completely unlocked
|
||||
eam_event_t(42, 0, eam_event_refresh_and_check(2, eam_contract_state_none, eam_contract_state_none, 0, 2 * alice_bob_start_amount - a_proposal_fee - TESTS_DEFAULT_FEE)), // update 41..42
|
||||
eam_event_t(50, 0, eam_event_refresh_and_check(16, eam_contract_state_none, eam_contract_state_none, alice_bob_start_amount - a_proposal_fee, alice_bob_start_amount)), // detach 34..35, update 34..49
|
||||
|
||||
// the following two line commened by sowle 2019-04-26
|
||||
// reason: tx linked with alt blocks are not removed from the pool on expiration or when outdated
|
||||
// so atm this test should wait until related alt block will be removed from the blockchain -> this will let tx pool to remove expired tx -> coins will be unlocked
|
||||
// should be tested differently somehow
|
||||
// TODO: need more attention here
|
||||
//
|
||||
//eam_event_t(51, 0, eam_event_transfer(wallet_test::ALICE_ACC_IDX, wallet_test::BOB_ACC_IDX, alice_bob_start_amount - a_proposal_fee - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE)), // make sure money are completely unlocked
|
||||
//eam_event_t(52, 0, eam_event_refresh_and_check(2, eam_contract_state_none, eam_contract_state_none, 0, 2 * alice_bob_start_amount - a_proposal_fee - TESTS_DEFAULT_FEE)), // update 51..52
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
bool r = false, need_to_resign = false;
|
||||
|
||||
uint64_t a_inputs_amount = (~custom_config_mask & eccf_template_inv_a_inputs) ? cpd.amount_a_pledge + cpd.amount_to_pay : TX_DEFAULT_FEE * 2;
|
||||
uint64_t a_inputs_amount = (~custom_config_mask & eccf_template_inv_a_inputs) ? cpd.amount_a_pledge + cpd.amount_to_pay : TESTS_DEFAULT_FEE * 2;
|
||||
uint64_t ms_amount = (~custom_config_mask & eccf_template_inv_ms_amount) ? cpd.amount_a_pledge + cpd.amount_b_pledge + cpd.amount_to_pay + b_fee_release : cpd.amount_a_pledge + cpd.amount_b_pledge + cpd.amount_to_pay;
|
||||
|
||||
r = fill_tx_sources(sources, events, head, a_keys, a_inputs_amount, nmix, used_sources);
|
||||
|
|
@ -204,7 +204,7 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
|
|||
else if (custom_config_mask & eccf_template_more_than_1_multisig)
|
||||
{
|
||||
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // seems to be correct
|
||||
destinations.push_back(tx_destination_entry(TX_DEFAULT_FEE, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // double multisig - incorrect
|
||||
destinations.push_back(tx_destination_entry(TESTS_DEFAULT_FEE, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // double multisig - incorrect
|
||||
}
|
||||
else
|
||||
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // truly correct
|
||||
|
|
@ -334,7 +334,7 @@ inline bool build_custom_escrow_release_template(
|
|||
// inputs
|
||||
// create multisig (A-B) source, add keys from B
|
||||
tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = (~custom_config_mask & eccf_rel_template_inv_ms_amount) ? escrow_template_tx.vout[ms_idx].amount : escrow_template_tx.vout[ms_idx].amount + 10 * TX_DEFAULT_FEE;
|
||||
se.amount = (~custom_config_mask & eccf_rel_template_inv_ms_amount) ? escrow_template_tx.vout[ms_idx].amount : escrow_template_tx.vout[ms_idx].amount + 10 * TESTS_DEFAULT_FEE;
|
||||
se.multisig_id = ms_id;
|
||||
se.real_output_in_tx_index = ms_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(escrow_template_tx);
|
||||
|
|
@ -363,7 +363,7 @@ inline bool build_custom_escrow_release_template(
|
|||
{
|
||||
destinations.push_back(tx_destination_entry(cpd.amount_a_pledge, cpd.a_addr));
|
||||
destinations.push_back(tx_destination_entry(cpd.amount_b_pledge + cpd.amount_to_pay, cpd.b_addr));
|
||||
destinations.push_back(tx_destination_entry(10 * TX_DEFAULT_FEE, cpd.b_addr));
|
||||
destinations.push_back(tx_destination_entry(10 * TESTS_DEFAULT_FEE, cpd.b_addr));
|
||||
}
|
||||
else
|
||||
{ // correct
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
LOG_PRINT_MAGENTA("Seller Address: " << currency::get_account_address_as_str(accunt_seller.get_public_address()), LOG_LEVEL_0);
|
||||
|
||||
|
||||
#define AMOUNT_TO_TRANSFER_ESCROW (TX_DEFAULT_FEE*10)
|
||||
#define AMOUNT_TO_TRANSFER_ESCROW (TESTS_DEFAULT_FEE*10)
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_mining_accunt);
|
||||
|
||||
size_t blocks_fetched = 0;
|
||||
|
|
@ -74,11 +74,11 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
// CHECK_AND_FORCE_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW, false, "Incorrect numbers of blocks fetched");
|
||||
CHECK_AND_FORCE_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW * 2 + TX_DEFAULT_FEE, accunt_buyer.get_public_address());
|
||||
LOG_PRINT_MAGENTA("Transaction sent to buyer_account: " << AMOUNT_TO_TRANSFER_ESCROW * 2 + TX_DEFAULT_FEE, LOG_LEVEL_0);
|
||||
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW * 2 + TESTS_DEFAULT_FEE, accunt_buyer.get_public_address());
|
||||
LOG_PRINT_MAGENTA("Transaction sent to buyer_account: " << AMOUNT_TO_TRANSFER_ESCROW * 2 + TESTS_DEFAULT_FEE, LOG_LEVEL_0);
|
||||
|
||||
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW + TX_DEFAULT_FEE * 2, accunt_seller.get_public_address());
|
||||
LOG_PRINT_MAGENTA("Transaction sent to seller_account: " << AMOUNT_TO_TRANSFER_ESCROW + TX_DEFAULT_FEE * 2, LOG_LEVEL_0);
|
||||
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW + TESTS_DEFAULT_FEE * 2, accunt_seller.get_public_address());
|
||||
LOG_PRINT_MAGENTA("Transaction sent to seller_account: " << AMOUNT_TO_TRANSFER_ESCROW + TESTS_DEFAULT_FEE * 2, LOG_LEVEL_0);
|
||||
|
||||
bool r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
|
||||
|
|
@ -92,8 +92,8 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
wallet_seller->callback(seller_backend_mock);
|
||||
wallet_buyer->refresh();
|
||||
wallet_seller->refresh();
|
||||
CHECK_AND_FORCE_ASSERT_MES(wallet_buyer->balance() == AMOUNT_TO_TRANSFER_ESCROW * 2 + TX_DEFAULT_FEE, false, "Incorrect balance");
|
||||
CHECK_AND_FORCE_ASSERT_MES(wallet_seller->balance() == AMOUNT_TO_TRANSFER_ESCROW + TX_DEFAULT_FEE * 2, false, "Incorrect balance");
|
||||
CHECK_AND_FORCE_ASSERT_MES(wallet_buyer->balance() == AMOUNT_TO_TRANSFER_ESCROW * 2 + TESTS_DEFAULT_FEE, false, "Incorrect balance");
|
||||
CHECK_AND_FORCE_ASSERT_MES(wallet_seller->balance() == AMOUNT_TO_TRANSFER_ESCROW + TESTS_DEFAULT_FEE * 2, false, "Incorrect balance");
|
||||
|
||||
|
||||
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
|
||||
|
|
@ -106,7 +106,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
cpd.amount_to_pay = AMOUNT_TO_TRANSFER_ESCROW;
|
||||
cpd.comment = "I'll build by own theme park. With black jack, and hookers.";
|
||||
cpd.title = "Afterlife? If I thought I had to live another life, I'd kill myself right now!";
|
||||
wallet_buyer->send_escrow_proposal(cpd, 0, 0, 3600, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", escrow_proposal_tx, escrow_template_tx);
|
||||
wallet_buyer->send_escrow_proposal(cpd, 0, 0, 3600, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", escrow_proposal_tx, escrow_template_tx);
|
||||
|
||||
auto it = std::find_if(escrow_template_tx.vout.begin(), escrow_template_tx.vout.end(), [](const tx_out& o){
|
||||
if (o.target.type() == typeid(txout_multisig))
|
||||
|
|
@ -145,7 +145,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
//----------------------
|
||||
// accept proposal
|
||||
//----------------------
|
||||
wallet_seller->accept_proposal(multisig_id, TX_DEFAULT_FEE);
|
||||
wallet_seller->accept_proposal(multisig_id, TESTS_DEFAULT_FEE);
|
||||
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
|
|
@ -229,11 +229,11 @@ bool escrow_wallet_test::exec_test_with_cancel_release_type(currency::core& c, c
|
|||
//----------------------
|
||||
wallet_miner = init_playtime_test_wallet(events, c, m_mining_accunt);
|
||||
wallet_miner->refresh();
|
||||
wallet_miner->transfer(TX_DEFAULT_FEE, wallet_buyer->get_account().get_public_address());
|
||||
wallet_miner->transfer(TESTS_DEFAULT_FEE, wallet_buyer->get_account().get_public_address());
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 10);
|
||||
wallet_buyer->refresh();
|
||||
tools::wallet2::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
wallet_buyer->request_cancel_contract(multisig_id, TX_DEFAULT_FEE, 60 * 60);
|
||||
wallet_buyer->request_cancel_contract(multisig_id, TESTS_DEFAULT_FEE, 60 * 60);
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 2);
|
||||
wallet_buyer->refresh();
|
||||
wallet_seller->refresh();
|
||||
|
|
@ -295,7 +295,7 @@ bool escrow_wallet_test::c1(currency::core& c, size_t ev_index, const std::vecto
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
escrow_w_and_fake_outputs::escrow_w_and_fake_outputs()
|
||||
: m_pledge_amount(TX_DEFAULT_FEE * 9)
|
||||
: m_pledge_amount(TESTS_DEFAULT_FEE * 9)
|
||||
, m_alice_bob_start_chunk_amount(0)
|
||||
{
|
||||
REGISTER_CALLBACK_METHOD(escrow_w_and_fake_outputs, c1);
|
||||
|
|
@ -366,7 +366,7 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
|
|||
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
|
||||
cpd.amount_a_pledge = m_pledge_amount;
|
||||
cpd.amount_b_pledge = m_pledge_amount;
|
||||
cpd.amount_to_pay = TX_DEFAULT_FEE * 7;
|
||||
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 7;
|
||||
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
|
||||
cpd.comment = get_random_text(1024);
|
||||
|
|
@ -375,13 +375,13 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
|
|||
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
|
||||
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
|
||||
test_core_time::adjust(boost::get<block>(events[ev_index - 1]).timestamp + 5); // determenistic time, 'cause escrow template uses current time => time affects hashes
|
||||
alice_wlt->send_escrow_proposal(cpd, fake_outs_count, 0, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, fake_outs_count, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
uint64_t alice_post_proposal_balance = alice_wlt->balance();
|
||||
uint64_t alice_spent_for_proposal = alice_start_balance - alice_post_proposal_balance;
|
||||
uint64_t alice_expected_spends_for_proposal = TX_DEFAULT_FEE;
|
||||
uint64_t alice_expected_spends_for_proposal = TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(alice_spent_for_proposal == alice_expected_spends_for_proposal, false, "Incorrect Alice post-proposal balance: " << alice_post_proposal_balance << ENDL <<
|
||||
"Alice has spent for sending proposal: " << alice_spent_for_proposal << ENDL <<
|
||||
"Alice should spend for sending proposal: " << alice_expected_spends_for_proposal << " (pledge: " << cpd.amount_a_pledge << ", amount: " << cpd.amount_to_pay << ", fee: " << TX_DEFAULT_FEE << ")");
|
||||
"Alice should spend for sending proposal: " << alice_expected_spends_for_proposal << " (pledge: " << cpd.amount_a_pledge << ", amount: " << cpd.amount_to_pay << ", fee: " << TESTS_DEFAULT_FEE << ")");
|
||||
CHECK_AND_ASSERT_MES(check_wallet_balance_blocked_for_escrow(*alice_wlt.get(), "Alice", cpd.amount_a_pledge + cpd.amount_to_pay), false, "");
|
||||
|
||||
// check that inputs contain correct number of fake mix-ins
|
||||
|
|
@ -402,7 +402,7 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
|
|||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
bob_wlt->refresh();
|
||||
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -424,20 +424,20 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
|
|||
alice_wlt->reset_history(); // just for watching full wallet's history in the log on refresh
|
||||
alice_wlt->refresh();
|
||||
// Alice pays fee ones: for sending a proposal
|
||||
uint64_t alice_estimated_end_balance = alice_start_balance - cpd.amount_to_pay - TX_DEFAULT_FEE * 1;
|
||||
uint64_t alice_estimated_end_balance = alice_start_balance - cpd.amount_to_pay - TESTS_DEFAULT_FEE * 1;
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice", alice_estimated_end_balance, 0, alice_estimated_end_balance, 0, 0))
|
||||
return false;
|
||||
|
||||
bob_wlt->reset_history(); // just for watching full wallet's history in the log on refresh
|
||||
bob_wlt->refresh();
|
||||
// Bob pays double fee: one for accepting prorpsal and another for finishing contract
|
||||
uint64_t bob_estimated_end_balance = bob_start_balance + cpd.amount_to_pay - TX_DEFAULT_FEE * 2;
|
||||
uint64_t bob_estimated_end_balance = bob_start_balance + cpd.amount_to_pay - TESTS_DEFAULT_FEE * 2;
|
||||
if (!check_balance_via_wallet(*bob_wlt.get(), "bob", bob_estimated_end_balance, 0, bob_estimated_end_balance, 0, 0))
|
||||
return false;
|
||||
|
||||
// withdraw all money from Bob and Alice accounts to make sure they're spendadble
|
||||
alice_wlt->transfer(alice_estimated_end_balance - TX_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
|
||||
bob_wlt->transfer(bob_estimated_end_balance - TX_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
|
||||
alice_wlt->transfer(alice_estimated_end_balance - TESTS_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
|
||||
bob_wlt->transfer(bob_estimated_end_balance - TESTS_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 2, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
|
|||
// make sure money was successfully transferred
|
||||
std::shared_ptr<tools::wallet2> carol_wlt = init_playtime_test_wallet(events, c, CAROL_ACC_IDX);
|
||||
carol_wlt->refresh();
|
||||
if (!check_balance_via_wallet(*carol_wlt.get(), "carol", alice_estimated_end_balance + bob_estimated_end_balance - TX_DEFAULT_FEE * 2))
|
||||
if (!check_balance_via_wallet(*carol_wlt.get(), "carol", alice_estimated_end_balance + bob_estimated_end_balance - TESTS_DEFAULT_FEE * 2))
|
||||
return false;
|
||||
|
||||
// and make sure Alice's and Bob's wallets are empty
|
||||
|
|
@ -488,13 +488,13 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
std::vector<tx_source_entry> used_sources;
|
||||
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
|
||||
cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
|
||||
cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
|
||||
cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
|
||||
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
|
||||
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
|
||||
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
|
||||
cpd.a_addr = miner_acc.get_public_address();
|
||||
cpd.b_addr = alice_acc.get_public_address();
|
||||
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, cpd.amount_b_pledge + TX_DEFAULT_FEE * 2, blk_0r);
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, cpd.amount_b_pledge + TESTS_DEFAULT_FEE * 2, blk_0r);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
|
@ -506,7 +506,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
uint64_t normal_escrow_mask = eccf_proposal_additional_attach | eccf_template_additional_extra | eccf_template_additional_attach;
|
||||
transaction normal_escrow_proposal_tx = AUTO_VAL_INIT(normal_escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, miner_acc.get_keys(), cpd, 0, 0, 0, blk_1r.timestamp + 3600, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, normal_escrow_mask, normal_escrow_proposal_tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, miner_acc.get_keys(), cpd, 0, 0, 0, blk_1r.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, normal_escrow_mask, normal_escrow_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
|
||||
events.push_back(normal_escrow_proposal_tx);
|
||||
|
|
@ -551,7 +551,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
cpd.comment = "#" + std::to_string(i) + " " + custom_config_masks[i].name;
|
||||
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, top_block.timestamp + 3600, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, config_mask, escrow_proposal_tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, top_block.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, config_mask, escrow_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(escrow_proposal_tx) << " is built for mask: " << cpd.comment, LOG_LEVEL_0);
|
||||
|
|
@ -580,7 +580,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
cpd.comment = "incorrect unlock time (past)";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
// set unlock time to the past (suppose it's incorrect for escrow proposals)
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, top_block.timestamp, 0, top_block.timestamp, 0, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, top_block.timestamp, 0, top_block.timestamp, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -593,7 +593,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
// set unlock time to the future (suppose it's incorrect for escrow proposals)
|
||||
uint64_t unlock_time = top_block.timestamp + 365 * 24 * 60 * 60;
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, unlock_time, 0, unlock_time, 0, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, unlock_time, 0, unlock_time, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -604,7 +604,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
{
|
||||
cpd.comment = "template zero expiration time";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, 0, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -617,7 +617,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
uint64_t proposal_expiration_time = top_block.timestamp + 12 * 60 * 60;
|
||||
uint64_t template_expiration_time = top_block.timestamp + 12 * 60 * 60;
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, proposal_expiration_time, 0, template_expiration_time, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, proposal_expiration_time, 0, template_expiration_time, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -648,7 +648,7 @@ bool escrow_incorrect_proposal::check_normal_proposal(currency::core& c, size_t
|
|||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
alice_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
|
||||
alice_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -758,9 +758,9 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
|
|||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
|
||||
cpd.amount_a_pledge = TX_DEFAULT_FEE * 9;
|
||||
cpd.amount_b_pledge = TX_DEFAULT_FEE * 9;
|
||||
cpd.amount_to_pay = TX_DEFAULT_FEE * 7;
|
||||
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 9;
|
||||
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 9;
|
||||
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 7;
|
||||
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
|
||||
cpd.comment = get_random_text(2048);
|
||||
|
|
@ -770,10 +770,10 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
|
|||
|
||||
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
|
||||
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
LOG_PRINT_CYAN("alice transfers: " << ENDL << alice_wlt->dump_trunsfers(), LOG_LEVEL_0);
|
||||
uint64_t alice_post_proposal_balance = alice_wlt->balance();
|
||||
uint64_t alice_post_proposal_balance_expected = alice_start_balance - TX_DEFAULT_FEE;
|
||||
uint64_t alice_post_proposal_balance_expected = alice_start_balance - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(alice_post_proposal_balance == alice_post_proposal_balance_expected, false, "Incorrect alice_post_proposal_balance: " << print_money(alice_post_proposal_balance) << ", expected: " << print_money(alice_post_proposal_balance_expected));
|
||||
std::deque<tools::wallet2::transfer_details> transfers;
|
||||
alice_wlt->get_transfers(transfers);
|
||||
|
|
@ -803,7 +803,7 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
|
|||
// check Alice's balance
|
||||
alice_wlt->refresh();
|
||||
uint64_t alice_balance = alice_wlt->balance();
|
||||
uint64_t alice_expected_balance = alice_start_balance - TX_DEFAULT_FEE;
|
||||
uint64_t alice_expected_balance = alice_start_balance - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(alice_balance == alice_expected_balance, false, "Alice has incorrect balance after her proposal is expired: " << alice_balance << ", expected: " << alice_expected_balance);
|
||||
|
||||
// check Bob's contracts
|
||||
|
|
@ -813,7 +813,7 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
|
|||
r = false;
|
||||
try
|
||||
{
|
||||
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
|
||||
}
|
||||
catch (tools::error::tx_rejected&)
|
||||
{
|
||||
|
|
@ -841,9 +841,9 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
|
|||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
||||
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
|
||||
cpd.amount_a_pledge = TX_DEFAULT_FEE * 7;
|
||||
cpd.amount_b_pledge = TX_DEFAULT_FEE * 7;
|
||||
cpd.amount_to_pay = TX_DEFAULT_FEE * 13;
|
||||
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 7;
|
||||
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 7;
|
||||
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 13;
|
||||
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
|
||||
cpd.comment = get_random_text(2048);
|
||||
|
|
@ -853,7 +853,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
|
|||
|
||||
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
|
||||
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
LOG_PRINT_CYAN("%%%%% Escrow proposal sent, Alice's transfers: " << ENDL << alice_wlt->dump_trunsfers(), LOG_LEVEL_0);
|
||||
CHECK_AND_ASSERT_MES(check_wallet_balance_blocked_for_escrow(*alice_wlt.get(), "Alice", cpd.amount_a_pledge + cpd.amount_to_pay), false, "");
|
||||
crypto::hash ms_id = get_multisig_out_id(escrow_template_tx, get_multisig_out_index(escrow_template_tx.vout));
|
||||
|
|
@ -887,7 +887,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
|
|||
r = false;
|
||||
try
|
||||
{
|
||||
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
|
||||
}
|
||||
catch (tools::error::tx_rejected&)
|
||||
{
|
||||
|
|
@ -910,7 +910,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
|
|||
r = false;
|
||||
try
|
||||
{
|
||||
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
|
||||
}
|
||||
catch (tools::error::tx_rejected&)
|
||||
{
|
||||
|
|
@ -918,7 +918,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
|
|||
}
|
||||
CHECK_AND_ASSERT_MES(r, false, "Bob tried to accept an expired proposal, but wallet exception was not caught");
|
||||
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance), false, "");
|
||||
|
||||
return true;
|
||||
|
|
@ -1079,7 +1079,7 @@ bool escrow_proposal_and_accept_expiration::c1(currency::core& c, size_t ev_inde
|
|||
}
|
||||
CHECK_AND_ASSERT_MES(r, false, "Bob tried to accept an expired proposal, but wallet exception was not caught");
|
||||
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance), false, "");
|
||||
|
||||
return true;
|
||||
|
|
@ -1131,20 +1131,20 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
||||
// prepare contract details
|
||||
m_cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
|
||||
m_cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
|
||||
m_cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
|
||||
m_cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
|
||||
m_cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
|
||||
m_cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
|
||||
m_cpd.a_addr = alice_acc.get_public_address();
|
||||
m_cpd.b_addr = bob_acc.get_public_address();
|
||||
m_bob_fee_release = 10 * TX_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
|
||||
uint64_t bob_fee_acceptance = TX_DEFAULT_FEE;
|
||||
m_bob_fee_release = 10 * TESTS_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
|
||||
uint64_t bob_fee_acceptance = TESTS_DEFAULT_FEE;
|
||||
|
||||
std::vector<tx_source_entry> used_sources;
|
||||
|
||||
// create escrow proposal
|
||||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TX_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
events.push_back(escrow_proposal_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, escrow_proposal_tx);
|
||||
|
|
@ -1152,7 +1152,7 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
// create normal acceptance
|
||||
transaction escrow_normal_acceptance_tx = prop.tx_template;
|
||||
uint64_t normal_acceptance_mask = eccf_acceptance_no_tsa_compression;
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TX_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_acceptance_tx);
|
||||
|
|
@ -1311,13 +1311,13 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
|
|||
alice_wlt->dump_trunsfers(ss, false);
|
||||
LOG_PRINT_L0("check_normal_acceptance(" << release_instruction << "):" << ENDL << "Alice transfers: " << ENDL << ss.str());
|
||||
uint64_t alice_balance = alice_wlt->balance();
|
||||
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE;
|
||||
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(alice_balance == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance << ", expected: " << alice_balance_expected);
|
||||
|
||||
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, BOB_ACC_IDX);
|
||||
bob_wlt->refresh();
|
||||
uint64_t bob_balance = bob_wlt->balance();
|
||||
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE;
|
||||
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(bob_balance == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance << ", expected: " << bob_balance_expected);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
|
@ -1352,8 +1352,8 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
|
|||
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Bob has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
|
||||
|
||||
uint64_t bob_balance_end = bob_wlt->balance();
|
||||
bob_balance_expected = release_normal ? (m_alice_bob_start_amount + m_cpd.amount_to_pay - m_bob_fee_release - TX_DEFAULT_FEE) :
|
||||
(m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE);
|
||||
bob_balance_expected = release_normal ? (m_alice_bob_start_amount + m_cpd.amount_to_pay - m_bob_fee_release - TESTS_DEFAULT_FEE) :
|
||||
(m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(bob_balance_end == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance_end << ", expected: " << bob_balance_expected);
|
||||
|
||||
alice_wlt->refresh();
|
||||
|
|
@ -1366,8 +1366,8 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
|
|||
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Alice has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
|
||||
|
||||
uint64_t alice_balance_end = alice_wlt->balance();
|
||||
alice_balance_expected = release_normal ? (m_alice_bob_start_amount - m_cpd.amount_to_pay - TX_DEFAULT_FEE) :
|
||||
(m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE);
|
||||
alice_balance_expected = release_normal ? (m_alice_bob_start_amount - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE) :
|
||||
(m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(alice_balance_end == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance_end << ", expected: " << alice_balance_expected);
|
||||
|
||||
return true;
|
||||
|
|
@ -1473,12 +1473,12 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
ADJUST_TEST_CORE_TIME(ts);
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
|
||||
|
||||
const uint64_t chunk_amount = 10 * TX_DEFAULT_FEE;
|
||||
const uint64_t chunk_amount = 10 * TESTS_DEFAULT_FEE;
|
||||
const size_t chunks_count = 20;
|
||||
uint64_t alice_bob_start_amount = chunks_count * chunk_amount;
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * alice_bob_start_amount, 0, true, true, false);
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * alice_bob_start_amount + TESTS_DEFAULT_FEE, 0, true, true, false);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
for(size_t i = 0; i < chunks_count; ++i)
|
||||
{
|
||||
|
|
@ -1505,17 +1505,17 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
escrow_custom_test_callback_details cd = AUTO_VAL_INIT(cd);
|
||||
cd.alice_bob_start_amount = alice_bob_start_amount;
|
||||
cd.cpd.comment = "normal contract";
|
||||
cd.cpd.amount_a_pledge = 70 * TX_DEFAULT_FEE;
|
||||
cd.cpd.amount_b_pledge = 94 * TX_DEFAULT_FEE;
|
||||
cd.cpd.amount_to_pay = 18 * TX_DEFAULT_FEE;
|
||||
cd.cpd.amount_a_pledge = 70 * TESTS_DEFAULT_FEE;
|
||||
cd.cpd.amount_b_pledge = 94 * TESTS_DEFAULT_FEE;
|
||||
cd.cpd.amount_to_pay = 18 * TESTS_DEFAULT_FEE;
|
||||
cd.cpd.a_addr = alice_acc.get_public_address();
|
||||
cd.cpd.b_addr = bob_acc.get_public_address();
|
||||
cd.fake_outputs_count = 0;
|
||||
cd.unlock_time = 0;
|
||||
cd.proposal_expiration_period = 3600;
|
||||
cd.a_proposal_fee = 10 * TX_DEFAULT_FEE;
|
||||
cd.b_accept_fee = 1 * TX_DEFAULT_FEE;
|
||||
cd.b_release_fee = 5 * TX_DEFAULT_FEE;
|
||||
cd.a_proposal_fee = 10 * TESTS_DEFAULT_FEE;
|
||||
cd.b_accept_fee = 1 * TESTS_DEFAULT_FEE;
|
||||
cd.b_release_fee = 5 * TESTS_DEFAULT_FEE;
|
||||
cd.payment_id = "payment id";
|
||||
cd.release_type = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL;
|
||||
test_details.push_back(cd);
|
||||
|
|
@ -1574,7 +1574,7 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
escrow_custom_test_callback_details cd = test_details[0];
|
||||
cd.cpd.comment = "simple cancellation";
|
||||
cd.release_type = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_CANCEL;
|
||||
cd.a_cancel_proposal_fee = 3 * TX_DEFAULT_FEE;
|
||||
cd.a_cancel_proposal_fee = 3 * TESTS_DEFAULT_FEE;
|
||||
cd.cancellation_expiration_period = 1000;
|
||||
test_details.push_back(cd);
|
||||
}
|
||||
|
|
@ -1583,7 +1583,7 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
escrow_custom_test_callback_details cd = test_details[0];
|
||||
cd.cpd.comment = "release normal after cancellation request";
|
||||
cd.release_type = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL;
|
||||
cd.a_cancel_proposal_fee = 3 * TX_DEFAULT_FEE; // this will trigger cancellation request
|
||||
cd.a_cancel_proposal_fee = 3 * TESTS_DEFAULT_FEE; // this will trigger cancellation request
|
||||
cd.cancellation_expiration_period = 1000;
|
||||
test_details.push_back(cd);
|
||||
}
|
||||
|
|
@ -1894,14 +1894,14 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
|
||||
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, ts);
|
||||
ADJUST_TEST_CORE_TIME(ts);
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 9);
|
||||
|
||||
const uint64_t chunk_amount = 20 * TX_DEFAULT_FEE;
|
||||
const uint64_t chunk_amount = 20 * TESTS_DEFAULT_FEE;
|
||||
const size_t chunks_count = 20;
|
||||
m_alice_bob_start_amount = chunks_count * chunk_amount;
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * m_alice_bob_start_amount, 0, true, true, false);
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * m_alice_bob_start_amount+ TESTS_DEFAULT_FEE, 0, true, true, false);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
for(size_t i = 0; i < chunks_count; ++i)
|
||||
{
|
||||
|
|
@ -1919,19 +1919,19 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
||||
// prepare contract details
|
||||
m_cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
|
||||
m_cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
|
||||
m_cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
|
||||
m_cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
|
||||
m_cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
|
||||
m_cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
|
||||
m_cpd.a_addr = alice_acc.get_public_address();
|
||||
m_cpd.b_addr = bob_acc.get_public_address();
|
||||
m_bob_fee_release = 10 * TX_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
|
||||
m_bob_fee_release = 10 * TESTS_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
|
||||
|
||||
std::vector<tx_source_entry> used_sources;
|
||||
|
||||
// create normal escrow proposal
|
||||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TX_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
events.push_back(escrow_proposal_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, escrow_proposal_tx);
|
||||
|
|
@ -1939,7 +1939,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
// create normal escrow proposal acceptance
|
||||
transaction escrow_normal_acceptance_tx = prop.tx_template;
|
||||
uint64_t normal_acceptance_mask = eccf_acceptance_no_tsa_compression;
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TX_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_acceptance_tx);
|
||||
|
|
@ -1947,7 +1947,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
|
||||
// create normal cancel proposal
|
||||
transaction escrow_normal_cancel_proposal_tx = AUTO_VAL_INIT(escrow_normal_cancel_proposal_tx);
|
||||
r = build_custom_escrow_cancel_proposal(events, blk_3, 0, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_3.timestamp + 3600, TX_DEFAULT_FEE, eccf_normal, prop.tx_template, escrow_normal_cancel_proposal_tx, used_sources);
|
||||
r = build_custom_escrow_cancel_proposal(events, blk_3, 0, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_3.timestamp + 3600, TESTS_DEFAULT_FEE, eccf_normal, prop.tx_template, escrow_normal_cancel_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_cancel_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_cancel_proposal_tx);
|
||||
|
|
@ -2016,7 +2016,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
|
||||
transaction incorrect_cancellation_proposal_tx = prop.tx_template;
|
||||
r = build_custom_escrow_cancel_proposal(events, prev_block, 0, alice_acc.get_keys(), m_cpd, ccm_el.unlock_time, ccm_el.expiration_time, ccm_el.release_unlock_time, ccm_el.release_expiration_time,
|
||||
TX_DEFAULT_FEE, mask, prop.tx_template, incorrect_cancellation_proposal_tx, used_sources);
|
||||
TESTS_DEFAULT_FEE, mask, prop.tx_template, incorrect_cancellation_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_cancel_proposal failed");
|
||||
|
||||
// In order to use the same escrow proposal to test different invalid cancellations we need to switch chains after each try
|
||||
|
|
@ -2067,13 +2067,13 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
|
|||
alice_wlt->dump_trunsfers(ss, false);
|
||||
LOG_PRINT_L0("check_normal_cancel_proposal:" << ENDL << "Alice transfers: " << ENDL << ss.str());
|
||||
uint64_t alice_balance = alice_wlt->balance();
|
||||
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE - TX_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
|
||||
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE - TESTS_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
|
||||
CHECK_AND_ASSERT_MES(alice_balance == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance << ", expected: " << alice_balance_expected);
|
||||
|
||||
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, BOB_ACC_IDX);
|
||||
bob_wlt->refresh();
|
||||
uint64_t bob_balance = bob_wlt->balance();
|
||||
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE;
|
||||
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(bob_balance == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance << ", expected: " << bob_balance_expected);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
|
@ -2110,7 +2110,7 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
|
|||
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Alice has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
|
||||
|
||||
uint64_t alice_balance_end = alice_wlt->balance();
|
||||
alice_balance_expected = m_alice_bob_start_amount - 2 * TX_DEFAULT_FEE;
|
||||
alice_balance_expected = m_alice_bob_start_amount - 2 * TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(alice_balance_end == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance_end << ", expected: " << alice_balance_expected);
|
||||
|
||||
bob_wlt->refresh();
|
||||
|
|
@ -2122,7 +2122,7 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
|
|||
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Bob has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
|
||||
|
||||
uint64_t bob_balance_end = bob_wlt->balance();
|
||||
bob_balance_expected = m_alice_bob_start_amount - m_bob_fee_release - TX_DEFAULT_FEE;
|
||||
bob_balance_expected = m_alice_bob_start_amount - m_bob_fee_release - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(bob_balance_end == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance_end << ", expected: " << bob_balance_expected);
|
||||
|
||||
return true;
|
||||
|
|
@ -2155,13 +2155,13 @@ bool escrow_incorrect_cancel_proposal::check_incorrect_cancel_proposal_internal(
|
|||
alice_wlt->dump_trunsfers(ss, false);
|
||||
LOG_PRINT_L0("Alice transfers: " << ENDL << ss.str());
|
||||
uint64_t alice_balance = alice_wlt->balance();
|
||||
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE - TX_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
|
||||
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE - TESTS_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
|
||||
CHECK_AND_ASSERT_MES(alice_balance == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance << ", expected: " << alice_balance_expected);
|
||||
|
||||
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, BOB_ACC_IDX);
|
||||
bob_wlt->refresh();
|
||||
uint64_t bob_balance = bob_wlt->balance();
|
||||
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE;
|
||||
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(bob_balance == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance << ", expected: " << bob_balance_expected);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
|
@ -2257,7 +2257,7 @@ bool escrow_proposal_not_enough_money::c1(currency::core& c, size_t ev_index, co
|
|||
try
|
||||
{
|
||||
uint64_t expiration_time = test_core_time::get_time() + 10; // ten seconds
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TX_DEFAULT_FEE, COIN * 10000000, "", proposal_tx, escrow_template_tx); // use too big b_release_fee just to make sure it does not affects anything on that stage
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, COIN * 10000000, "", proposal_tx, escrow_template_tx); // use too big b_release_fee just to make sure it does not affects anything on that stage
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
|
|
@ -2304,12 +2304,12 @@ bool escrow_cancellation_and_tx_order::generate(std::vector<test_event_entry>& e
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2347,7 +2347,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
|
|||
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
|
||||
uint64_t expiration_time = test_core_time::get_time() + 60;
|
||||
LOG_PRINT_GREEN("\n" "alice_wlt->send_escrow_proposal()", LOG_LEVEL_0);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
|
|
@ -2373,7 +2373,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
// Bob accepts the proposal
|
||||
LOG_PRINT_GREEN("\n" "bob_wlt->accept_proposal()", LOG_LEVEL_0);
|
||||
bob_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
|
||||
|
||||
// mine a block containing contract acceptance
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
|
@ -2391,7 +2391,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
// Alice requests cancellation
|
||||
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
|
||||
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, 60 * 60);
|
||||
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, 60 * 60);
|
||||
|
||||
// cancel request must be in the pool now
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
|
@ -2504,12 +2504,12 @@ bool escrow_cancellation_proposal_expiration::generate(std::vector<test_event_en
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2542,13 +2542,13 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
|
|||
cpd.amount_to_pay = MK_TEST_COINS(8);
|
||||
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
|
||||
uint64_t b_release_fee = TX_DEFAULT_FEE * 2;
|
||||
uint64_t b_release_fee = TESTS_DEFAULT_FEE * 2;
|
||||
|
||||
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
|
||||
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
|
||||
uint64_t expiration_time = test_core_time::get_time() + 60;
|
||||
LOG_PRINT_GREEN("\n" "alice_wlt->send_escrow_proposal()", LOG_LEVEL_0);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TX_DEFAULT_FEE, b_release_fee, "", proposal_tx, escrow_template_tx);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, b_release_fee, "", proposal_tx, escrow_template_tx);
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
|
|
@ -2577,7 +2577,7 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
|
|||
|
||||
// Bob accepts the proposal
|
||||
LOG_PRINT_GREEN("\n" "bob_wlt->accept_proposal()", LOG_LEVEL_0);
|
||||
bob_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
|
||||
|
||||
uint64_t bob_blocked_transfers_sum = 0;
|
||||
CHECK_AND_ASSERT_MES(estimate_wallet_balance_blocked_for_escrow(*bob_wlt.get(), bob_blocked_transfers_sum, false), false, "");
|
||||
|
|
@ -2600,7 +2600,7 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
|
|||
// Alice requests cancellation for the first time -- this request will not be included into a block and will expire in tx pool
|
||||
uint64_t cancel_request_expiration_period = 3; // seconds
|
||||
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
|
||||
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, cancel_request_expiration_period);
|
||||
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, cancel_request_expiration_period);
|
||||
uint64_t cancel_request_time = test_core_time::get_time(); // remember current time in order to check expiration
|
||||
LOG_PRINT_YELLOW(">>>>>>>>>>>>>>>>>>>>>> (1/2) cancel_request_time = " << cancel_request_time << " + period = " << cancel_request_expiration_period + cancel_request_time, LOG_LEVEL_0);
|
||||
|
||||
|
|
@ -2659,15 +2659,15 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 1), false, "");
|
||||
|
||||
// check balances
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
|
||||
|
||||
// ===== (2/2) =====
|
||||
// Alice requests cancellation for the second time -- this request will be included into a block and then will expire
|
||||
cancel_request_expiration_period = 3 * DIFFICULTY_POW_TARGET + 15;
|
||||
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
|
||||
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, cancel_request_expiration_period);
|
||||
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, cancel_request_expiration_period);
|
||||
cancel_request_time = test_core_time::get_time(); // remember current time in order to check expiration
|
||||
LOG_PRINT_YELLOW(">>>>>>>>>>>>>>>>>>>>>> (2/2) cancel_request_time = " << cancel_request_time << " + period = " << cancel_request_expiration_period + cancel_request_time, LOG_LEVEL_0);
|
||||
|
||||
|
|
@ -2721,8 +2721,8 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 7), false, "");
|
||||
|
||||
// check balances
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE - TX_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE - TESTS_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2751,12 +2751,12 @@ bool escrow_cancellation_acceptance_expiration::generate(std::vector<test_event_
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TX_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TX_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2789,7 +2789,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
|
|||
cpd.amount_to_pay = MK_TEST_COINS(3);
|
||||
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
|
||||
uint64_t b_release_fee = TX_DEFAULT_FEE * 2;
|
||||
uint64_t b_release_fee = TESTS_DEFAULT_FEE * 2;
|
||||
|
||||
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
|
||||
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
|
||||
|
|
@ -2818,7 +2818,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
|
|||
|
||||
// Bob accepts the proposal
|
||||
LOG_PRINT_GREEN("\n" "bob_wlt->accept_proposal()", LOG_LEVEL_0);
|
||||
bob_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
|
||||
bob_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
|
||||
|
||||
//uint64_t bob_blocked_transfers_sum = 0;
|
||||
//CHECK_AND_ASSERT_MES(estimate_wallet_balance_blocked_for_escrow(*bob_wlt.get(), bob_blocked_transfers_sum, false), false, "");
|
||||
|
|
@ -2834,7 +2834,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
|
|||
// Alice requests cancellation
|
||||
uint64_t cancel_request_expiration_period = DIFFICULTY_TOTAL_TARGET;
|
||||
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
|
||||
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, cancel_request_expiration_period);
|
||||
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, cancel_request_expiration_period);
|
||||
|
||||
// confirm cancellation request in blockchain
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
|
@ -2875,8 +2875,8 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 7), false, "");
|
||||
|
||||
// check final balances
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
|
||||
|
||||
|
||||
|
|
@ -2894,8 +2894,8 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 0), false, "");
|
||||
|
||||
// no changes with balances expected
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2931,19 +2931,19 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
|
|||
|
||||
// prepare contract details
|
||||
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
|
||||
cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
|
||||
cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
|
||||
cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
|
||||
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
|
||||
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
|
||||
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
|
||||
cpd.a_addr = alice_acc.get_public_address();
|
||||
cpd.b_addr = bob_acc.get_public_address();
|
||||
uint64_t bob_fee_release = 10 * TX_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
|
||||
uint64_t bob_fee_release = 10 * TESTS_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
|
||||
|
||||
std::vector<tx_source_entry> used_sources;
|
||||
|
||||
// escrow proposal
|
||||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1, alice_acc.get_keys(), cpd, 0, 0, 0, blk_1.timestamp + 36000, 0, TX_DEFAULT_FEE, bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
r = build_custom_escrow_proposal(events, blk_1, alice_acc.get_keys(), cpd, 0, 0, 0, blk_1.timestamp + 36000, 0, TESTS_DEFAULT_FEE, bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
events.push_back(escrow_proposal_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, escrow_proposal_tx);
|
||||
|
|
@ -2953,7 +2953,7 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
|
|||
// escrow proposal acceptance
|
||||
transaction escrow_normal_acceptance_tx = prop.tx_template;
|
||||
uint64_t normal_acceptance_mask = eccf_normal; //eccf_acceptance_no_tsa_compression;
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), cpd, 0, 0, 0, 0, TX_DEFAULT_FEE, bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_acceptance_tx);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ bool get_random_outs_test::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3r, miner_account, txs_blk_4); // 2N+10
|
||||
|
||||
MAKE_TX_LIST_START(events, txs_blk_5, bob_account, miner_account, m_amount - TX_DEFAULT_FEE, blk_4); // 2N+11
|
||||
MAKE_TX_LIST_START(events, txs_blk_5, bob_account, miner_account, m_amount - TESTS_DEFAULT_FEE, blk_4); // 2N+11
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_5, blk_4, miner_account, txs_blk_5); // 2N+12
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_5r, blk_5, miner_account, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 4N+12
|
||||
DO_CALLBACK(events, "check_get_rand_outs"); // 4N+13
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ bool mix_in_spent_outs::generate(std::vector<test_event_entry>& events) const
|
|||
DO_CALLBACK_PARAMS_STR(events, "check_outs_count", epee::serialization::store_t_to_json(check_outs_count_params(m_test_amount, 4)));
|
||||
|
||||
// spend 2 of 3 Alice's outputs with direct transfer (not mixins)
|
||||
MAKE_TX(events, tx_1, alice_acc, miner_acc, m_test_amount * 2 - TX_DEFAULT_FEE, blk_2); // mix_attr == 0
|
||||
MAKE_TX(events, tx_1, alice_acc, miner_acc, m_test_amount * 2 - TESTS_DEFAULT_FEE, blk_2); // mix_attr == 0
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_1);
|
||||
|
||||
// despite the fact all Alice's outputs are spent now, total number of outputs with such amount should not changed
|
||||
|
|
@ -262,7 +262,7 @@ bool mix_in_spent_outs::c1(currency::core& c, size_t ev_index, const std::vector
|
|||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "There are txs in the pool");
|
||||
|
||||
std::vector<tx_destination_entry> destinations({ tx_destination_entry(m_test_amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) });
|
||||
std::vector<tx_destination_entry> destinations({ tx_destination_entry(m_test_amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) });
|
||||
|
||||
// check that mixing in 3 or 2 fake outputs fails because of using already spend outputs
|
||||
for(size_t fake_outputs_to_mixin = 2; fake_outputs_to_mixin >= 2; fake_outputs_to_mixin--)
|
||||
|
|
@ -270,7 +270,7 @@ bool mix_in_spent_outs::c1(currency::core& c, size_t ev_index, const std::vector
|
|||
r = false;
|
||||
try
|
||||
{
|
||||
bob_wlt->transfer(destinations, fake_outputs_to_mixin, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment);
|
||||
bob_wlt->transfer(destinations, fake_outputs_to_mixin, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment);
|
||||
}
|
||||
catch (tools::error::not_enough_outs_to_mix& e)
|
||||
{
|
||||
|
|
@ -282,7 +282,7 @@ bool mix_in_spent_outs::c1(currency::core& c, size_t ev_index, const std::vector
|
|||
}
|
||||
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
bob_wlt->transfer(destinations, 1, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tx); // mixing in 1 fake output should be okay as Alice did not spend it
|
||||
bob_wlt->transfer(destinations, 1, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tx); // mixing in 1 fake output should be okay as Alice did not spend it
|
||||
|
||||
CHECK_AND_ASSERT_MES(tx.vin.size() == 1, false, "tx vin.size() is not 1");
|
||||
CHECK_AND_ASSERT_MES(tx.vin[0].type() == typeid(txin_to_key) && boost::get<txin_to_key>(tx.vin[0]).key_offsets.size() == 2, false, "Incorrect vin[0] type of key_offsets"); // make sure 1 fake output was used
|
||||
|
|
|
|||
|
|
@ -151,10 +151,14 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
|
|||
//multisig
|
||||
dst.back().addr.push_back(m_accunt_a.get_public_address());
|
||||
dst.back().addr.push_back(m_accunt_b.get_public_address());
|
||||
dst.back().amount = AMOUNT_TO_TRANSFER_MULTISIG + TX_DEFAULT_FEE;
|
||||
dst.back().amount = AMOUNT_TO_TRANSFER_MULTISIG + TESTS_DEFAULT_FEE;
|
||||
dst.back().minimum_sigs = dst.back().addr.size();
|
||||
transaction result_tx = AUTO_VAL_INIT(result_tx);
|
||||
<<<<<<< HEAD
|
||||
miner_wlt->transfer(dst, 0, 0, TX_DEFAULT_FEE, extra, attachments, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), result_tx);
|
||||
=======
|
||||
miner_wlt->transfer(dst, 0, 0, TESTS_DEFAULT_FEE, extra, attachments, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), result_tx);
|
||||
>>>>>>> master
|
||||
|
||||
bool r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
|
||||
|
|
@ -197,7 +201,7 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
|
|||
multisig_id,
|
||||
dst2,
|
||||
0,
|
||||
TX_DEFAULT_FEE,
|
||||
TESTS_DEFAULT_FEE,
|
||||
extra,
|
||||
attachments,
|
||||
tools::detail::ssi_digit,
|
||||
|
|
@ -373,46 +377,50 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW, false, "Incorrect numbers of blocks fetched");
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
uint64_t amount1 = TX_DEFAULT_FEE * 13 + 1;
|
||||
uint64_t amount2 = TX_DEFAULT_FEE * 11 + 2;
|
||||
uint64_t amount3 = TX_DEFAULT_FEE * 7 + 3;
|
||||
uint64_t amount4 = TX_DEFAULT_FEE * 5 + 4;
|
||||
uint64_t amount5 = TX_DEFAULT_FEE * 21;
|
||||
uint64_t amount6 = TX_DEFAULT_FEE * 23;
|
||||
uint64_t amount1 = TESTS_DEFAULT_FEE * 13 + 1;
|
||||
uint64_t amount2 = TESTS_DEFAULT_FEE * 11 + 2;
|
||||
uint64_t amount3 = TESTS_DEFAULT_FEE * 7 + 3;
|
||||
uint64_t amount4 = TESTS_DEFAULT_FEE * 5 + 4;
|
||||
uint64_t amount5 = TESTS_DEFAULT_FEE * 21;
|
||||
uint64_t amount6 = TESTS_DEFAULT_FEE * 23;
|
||||
|
||||
tx_destination_entry de1 = AUTO_VAL_INIT(de1);
|
||||
de1.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
|
||||
de1.addr.push_back(m_accounts[BOB_ACC_IDX].get_public_address());
|
||||
de1.amount = amount1 + TX_DEFAULT_FEE;
|
||||
de1.amount = amount1 + TESTS_DEFAULT_FEE;
|
||||
de1.minimum_sigs = de1.addr.size();
|
||||
tx_destination_entry de2 = AUTO_VAL_INIT(de2);
|
||||
de2.addr.push_back(m_accounts[CAROL_ACC_IDX].get_public_address());
|
||||
de2.addr.push_back(m_accounts[DAN_ACC_IDX].get_public_address());
|
||||
de2.amount = amount2 + TX_DEFAULT_FEE;
|
||||
de2.amount = amount2 + TESTS_DEFAULT_FEE;
|
||||
de2.minimum_sigs = de2.addr.size();
|
||||
tx_destination_entry de3 = AUTO_VAL_INIT(de3);
|
||||
de3.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
|
||||
de3.addr.push_back(m_accounts[DAN_ACC_IDX].get_public_address());
|
||||
de3.amount = amount3 + TX_DEFAULT_FEE;
|
||||
de3.amount = amount3 + TESTS_DEFAULT_FEE;
|
||||
de3.minimum_sigs = de3.addr.size();
|
||||
tx_destination_entry de4 = AUTO_VAL_INIT(de4);
|
||||
de4.addr.push_back(m_accounts[CAROL_ACC_IDX].get_public_address());
|
||||
de4.addr.push_back(m_accounts[BOB_ACC_IDX].get_public_address());
|
||||
de4.amount = amount4 + TX_DEFAULT_FEE;
|
||||
de4.amount = amount4 + TESTS_DEFAULT_FEE;
|
||||
de4.minimum_sigs = de4.addr.size();
|
||||
tx_destination_entry de5 = AUTO_VAL_INIT(de5);
|
||||
de5.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
|
||||
de5.amount = amount5 + TX_DEFAULT_FEE;
|
||||
de5.amount = amount5 + TESTS_DEFAULT_FEE;
|
||||
de5.minimum_sigs = de5.addr.size();
|
||||
tx_destination_entry de6 = AUTO_VAL_INIT(de6);
|
||||
de6.addr.push_back(m_accounts[DAN_ACC_IDX].get_public_address());
|
||||
de6.amount = amount6 + TX_DEFAULT_FEE;
|
||||
de6.amount = amount6 + TESTS_DEFAULT_FEE;
|
||||
de6.minimum_sigs = de6.addr.size();
|
||||
|
||||
// Send multisig tx
|
||||
transaction ms_tx = AUTO_VAL_INIT(ms_tx);
|
||||
miner_wlt->transfer(std::vector<tx_destination_entry>({ de1, de2, de3, de4, de5, de6 }),
|
||||
<<<<<<< HEAD
|
||||
0, 0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx);
|
||||
=======
|
||||
0, 0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx);
|
||||
>>>>>>> master
|
||||
|
||||
// calculate multisig hashes for further usage
|
||||
crypto::hash ms1_hash = currency::get_multisig_out_id(ms_tx, get_tx_out_index_by_amount(ms_tx, de1.amount));
|
||||
|
|
@ -433,7 +441,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, m_accounts[ALICE_ACC_IDX]);
|
||||
alice_wlt->refresh(blocks_fetched, received_money, atomic_false);
|
||||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
|
||||
r = check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", amount5 + TX_DEFAULT_FEE);
|
||||
r = check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", amount5 + TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
|
||||
tools::wallet2::multisig_transfer_container alice_mstc;
|
||||
alice_wlt->get_multisig_transfers(alice_mstc);
|
||||
|
|
@ -463,7 +471,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
std::shared_ptr<tools::wallet2> dan_wlt = init_playtime_test_wallet(events, c, m_accounts[DAN_ACC_IDX]);
|
||||
dan_wlt->refresh(blocks_fetched, received_money, atomic_false);
|
||||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
|
||||
r = check_balance_via_wallet(*dan_wlt.get(), "dan_wlt", amount6 + TX_DEFAULT_FEE);
|
||||
r = check_balance_via_wallet(*dan_wlt.get(), "dan_wlt", amount6 + TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
|
||||
tools::wallet2::multisig_transfer_container dan_mstc;
|
||||
dan_wlt->get_multisig_transfers(dan_mstc);
|
||||
|
|
@ -480,7 +488,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
currency::transaction tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms1_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount1, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
>>>>>>> master
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -495,7 +507,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
{
|
||||
// as 'false' means don't send to network. This should fail during preparation, not during sending/processing
|
||||
transfer_multisig(*bob_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms1_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount1, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
>>>>>>> master
|
||||
}
|
||||
catch (tools::error::wallet_internal_error&)
|
||||
{
|
||||
|
|
@ -514,7 +530,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*carol_wlt.get(), std::list<account_keys>({ m_accounts[DAN_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
>>>>>>> master
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -526,7 +546,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
{
|
||||
// as 'false' means don't send to network. This should fail during preparation, not during sending/processing
|
||||
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[CAROL_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
>>>>>>> master
|
||||
}
|
||||
catch (tools::error::wallet_internal_error&)
|
||||
{
|
||||
|
|
@ -542,7 +566,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
// Re-try spending Carol-Dan multisig out on behalf of Dan. It should be OK now
|
||||
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[CAROL_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
>>>>>>> master
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -560,7 +588,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[DAN_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
>>>>>>> master
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -571,7 +603,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
{
|
||||
// last 'false' means don't send to network. This should fail during preparation, not during sending/processing
|
||||
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
>>>>>>> master
|
||||
}
|
||||
catch (tools::error::wallet_internal_error&)
|
||||
{
|
||||
|
|
@ -601,7 +637,11 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
try
|
||||
{
|
||||
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
|
||||
>>>>>>> master
|
||||
}
|
||||
catch (tools::error::wallet_internal_error&)
|
||||
{
|
||||
|
|
@ -667,7 +707,7 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
|
|||
size_t blocks_fetched = 0;
|
||||
bool received_money = false, r = false;
|
||||
std::atomic<bool> atomic_false(false);
|
||||
static const uint64_t amount = TX_DEFAULT_FEE * 13;
|
||||
static const uint64_t amount = TESTS_DEFAULT_FEE * 13;
|
||||
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
|
||||
miner_wlt->refresh(blocks_fetched, received_money, atomic_false);
|
||||
|
|
@ -676,12 +716,12 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
|
|||
tx_destination_entry de = AUTO_VAL_INIT(de);
|
||||
de.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
|
||||
de.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address()); // multisig to the same address
|
||||
de.amount = amount + TX_DEFAULT_FEE;
|
||||
de.amount = amount + TESTS_DEFAULT_FEE;
|
||||
de.minimum_sigs = de.addr.size();
|
||||
|
||||
// transfer multisig to Alice
|
||||
transaction ms_tx = AUTO_VAL_INIT(ms_tx);
|
||||
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
|
||||
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
|
||||
|
||||
// mine the next PoW and make sure everythig is allright
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
|
|
@ -700,7 +740,11 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
|
|||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms_hash,
|
||||
std::vector<tx_destination_entry>({ tx_destination_entry(amount, m_accounts[BOB_ACC_IDX].get_public_address()) }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
>>>>>>> master
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -756,7 +800,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
size_t blocks_fetched = 0;
|
||||
bool received_money = false, r = false;
|
||||
std::atomic<bool> atomic_false(false);
|
||||
static const uint64_t amount = TX_DEFAULT_FEE * 13;
|
||||
static const uint64_t amount = TESTS_DEFAULT_FEE * 13;
|
||||
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
|
||||
miner_wlt->refresh(blocks_fetched, received_money, atomic_false);
|
||||
|
|
@ -765,12 +809,12 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
tx_destination_entry de = AUTO_VAL_INIT(de);
|
||||
de.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
|
||||
de.addr.push_back(m_accounts[BOB_ACC_IDX].get_public_address());
|
||||
de.amount = amount + TX_DEFAULT_FEE;
|
||||
de.amount = amount + TESTS_DEFAULT_FEE;
|
||||
de.minimum_sigs = de.addr.size();
|
||||
|
||||
// transfer multisig to Alice + Bob
|
||||
transaction ms_tx = AUTO_VAL_INIT(ms_tx);
|
||||
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
|
||||
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
|
||||
|
||||
// mine the next PoW and make sure everythig is allright
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
|
|
@ -794,7 +838,11 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
transaction ms_tx2 = AUTO_VAL_INIT(ms_tx2);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms_hash,
|
||||
std::vector<tx_destination_entry>({ de }),
|
||||
<<<<<<< HEAD
|
||||
0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx2);
|
||||
=======
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx2);
|
||||
>>>>>>> master
|
||||
|
||||
// check the pool and mine a block
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
|
|
@ -810,8 +858,13 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
// spend the last multisig(Miner, Bob) and transfer to Bob
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*miner_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms_hash2,
|
||||
<<<<<<< HEAD
|
||||
std::vector<tx_destination_entry>({ tx_destination_entry(amount - TX_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()) }),
|
||||
0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
=======
|
||||
std::vector<tx_destination_entry>({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
>>>>>>> master
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -823,7 +876,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
bob_wlt->refresh(blocks_fetched, received_money, atomic_false);
|
||||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3, false, "Incorrect number of blocks fetched.");
|
||||
|
||||
r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", amount - TX_DEFAULT_FEE);
|
||||
r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", amount - TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "check_balance_via_wallet failed");
|
||||
|
||||
return true;
|
||||
|
|
@ -859,14 +912,14 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
bool r = false;
|
||||
uint64_t amount = TX_DEFAULT_FEE * 17;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 17;
|
||||
|
||||
std::list<account_public_address> ms_addr_list({ miner_acc.get_public_address(), alice_acc.get_public_address(), bob_acc.get_public_address() });
|
||||
|
||||
// Case 1. Create multisig for three participants (Miner, Alice, Bob) and specify minimum_sigs == 4 (should fail on construction)
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 4);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 4);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, 0);
|
||||
|
|
@ -878,7 +931,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
// 2.2. Spend using 2 keys (Alice, Bob) by sending money to Bob
|
||||
sources.clear();
|
||||
destinations.clear();
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 2);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
|
|
@ -902,7 +955,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_sigs_count = 2;
|
||||
|
||||
tx_destination_entry de(se.amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
tx_destination_entry de(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
||||
// Transaction should be successfully created, but rejected by the core
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
|
|
@ -936,7 +989,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 2;
|
||||
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
r = sign_multisig_input_in_tx(tx_3, 0, bob_acc.get_keys(), tx_1, &tx_fully_signed);
|
||||
CHECK_AND_ASSERT_MES(r && !tx_fully_signed, false, "sign_multisig_input_in_tx failed, tx_fully_signed : " << tx_fully_signed);
|
||||
|
|
@ -951,7 +1004,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
// create source tx: tx_4
|
||||
sources.clear();
|
||||
destinations.clear();
|
||||
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_4 = AUTO_VAL_INIT(tx_4);
|
||||
|
|
@ -973,7 +1026,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 3;
|
||||
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// use sign_multisig_input_in_tx_custom to create tx with more signatures (3) than minimum_sigs (1)
|
||||
|
|
@ -994,7 +1047,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
// Case 5. Spending multisig output using more keys than required and, moreover, add some fake keys
|
||||
sources.clear();
|
||||
destinations.clear();
|
||||
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_6 = AUTO_VAL_INIT(tx_6);
|
||||
|
|
@ -1017,7 +1070,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 4;
|
||||
|
||||
transaction tx_7 = AUTO_VAL_INIT(tx_7);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// use sign_multisig_input_in_tx_custom to create tx with more signatures (4) than minimum_sigs (1)
|
||||
|
|
@ -1036,7 +1089,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
// Case 6. Spending multisig using too many redundant keys
|
||||
sources.clear();
|
||||
destinations.clear();
|
||||
r = fill_tx_sources_and_destinations(events, blk_5, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_5, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_8 = AUTO_VAL_INIT(tx_8);
|
||||
|
|
@ -1060,7 +1113,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = redundant_keys_count;
|
||||
|
||||
transaction tx_9 = AUTO_VAL_INIT(tx_9);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
tx_9.signatures[0].resize(redundant_keys_count, invalid_signature);
|
||||
|
|
@ -1106,7 +1159,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
|
|||
// tx_1: 1 real + 2 fake inputs => 1 multisig output (Miner + Alice, minimum_sigs = 1)
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 2, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 2, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
// Make sure tx_1 is successfully created
|
||||
|
|
@ -1137,7 +1190,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
|
|||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
|
||||
destinations.clear();
|
||||
destinations.push_back(tx_destination_entry(amount - TX_DEFAULT_FEE, alice_acc.get_public_address()));
|
||||
destinations.push_back(tx_destination_entry(amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()));
|
||||
|
||||
// Make sure tx is successfully created
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
|
|
@ -1153,7 +1206,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
|
|||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_2);
|
||||
|
||||
// Finally, check the balance of Alice's wallet
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount - TX_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount - TESTS_DEFAULT_FEE));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1178,13 +1231,13 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
test_core_time::adjust(blk_0r.timestamp); // adjust gentime time to blockchain timestamps
|
||||
|
||||
bool r = false;
|
||||
uint64_t amount = TX_DEFAULT_FEE * 9;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 9;
|
||||
std::list<account_public_address> ms_addr_list({ miner_acc.get_public_address(), alice_acc.get_public_address() });
|
||||
|
||||
// noramal input -> multisig output with unlock time
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
uint64_t unlock_time = blk_0r.timestamp + DIFFICULTY_TOTAL_TARGET * 3 + CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS;
|
||||
|
|
@ -1214,7 +1267,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
se.ms_sigs_count = 1;
|
||||
sources.assign({ se });
|
||||
|
||||
destinations.assign({ tx_destination_entry(amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) });
|
||||
destinations.assign({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) });
|
||||
|
||||
ADJUST_TEST_CORE_TIME(unlock_time - CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS - 1);
|
||||
|
||||
|
|
@ -1241,13 +1294,13 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
ADJUST_TEST_CORE_TIME(unlock_time_2 - CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS - 1);
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
MAKE_TX(events, tx_3, alice_acc, bob_acc, amount - TX_DEFAULT_FEE * 2, blk_2);
|
||||
MAKE_TX(events, tx_3, alice_acc, bob_acc, amount - TESTS_DEFAULT_FEE * 2, blk_2);
|
||||
|
||||
ADJUST_TEST_CORE_TIME(unlock_time_2 - CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS + 1);
|
||||
events.push_back(tx_3);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_3);
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE * 2));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE * 2));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0));
|
||||
|
||||
// Expiration time
|
||||
|
|
@ -1256,7 +1309,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
uint64_t expiration_time = generator.get_timestamps_median(get_block_hash(blk_3), TX_EXPIRATION_TIMESTAMP_CHECK_WINDOW) - DIFFICULTY_TOTAL_TARGET * 3;
|
||||
sources.clear();
|
||||
destinations.clear();
|
||||
r = fill_tx_sources_and_destinations(events, blk_3, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_3, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_4 = AUTO_VAL_INIT(tx_4);
|
||||
|
|
@ -1292,7 +1345,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
se.ms_sigs_count = 1;
|
||||
sources.assign({ se });
|
||||
|
||||
destinations.assign({ tx_destination_entry(amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) });
|
||||
destinations.assign({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) });
|
||||
|
||||
expiration_time = generator.get_timestamps_median(get_block_hash(blk_4), TX_EXPIRATION_TIMESTAMP_CHECK_WINDOW) - DIFFICULTY_TOTAL_TARGET * 3;
|
||||
extra_expiration_time = AUTO_VAL_INIT(extra_expiration_time);
|
||||
|
|
@ -1408,7 +1461,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 1;
|
||||
sources.assign({ se });
|
||||
|
||||
destinations.assign({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, bob_acc.get_public_address()) });
|
||||
destinations.assign({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) });
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
|
|
@ -1421,7 +1474,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1);
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, se.amount - TX_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, se.amount - TESTS_DEFAULT_FEE));
|
||||
|
||||
//
|
||||
// Part 2. The same for PoW
|
||||
|
|
@ -1438,7 +1491,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
std::list<account_public_address> ms_addr_list({ miner_acc.get_public_address(), alice_acc.get_public_address() });
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources_and_destinations(events, prev_block, miner_acc.get_keys(), ms_addr_list, blk_2_reward, TX_DEFAULT_FEE, 0, sources, destinations, false, false, 1);
|
||||
r = fill_tx_sources_and_destinations(events, prev_block, miner_acc.get_keys(), ms_addr_list, blk_2_reward, TESTS_DEFAULT_FEE, 0, sources, destinations, false, false, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction miner_tx = AUTO_VAL_INIT(miner_tx);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, miner_tx, height + CURRENCY_MINED_MONEY_UNLOCK_WINDOW, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1474,7 +1527,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 1;
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) }),
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2, 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
|
@ -1484,7 +1537,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3r, miner_acc, tx_2);
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, se.amount - TX_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, se.amount - TESTS_DEFAULT_FEE));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1511,7 +1564,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
|
|||
uint64_t amount_many_out_have = 0, stub = 0;
|
||||
r = calculate_amounts_many_outs_have_and_no_outs_have(generator.get_base_reward_for_next_block(get_block_hash(blk_0r)), amount_many_out_have, stub); // this amount corresponds to many outs, so no changeback will be generated
|
||||
CHECK_AND_ASSERT_MES(r, false, "calculate_amounts_many_outs_have_and_no_outs_have failed");
|
||||
uint64_t amount = amount_many_out_have - TX_DEFAULT_FEE;
|
||||
uint64_t amount = amount_many_out_have - TESTS_DEFAULT_FEE;
|
||||
|
||||
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
|
||||
|
||||
|
|
@ -1519,7 +1572,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
|
||||
// tx_1: normal input -> multisig output
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true);
|
||||
CHECK_AND_ASSERT_MES(r && sources.size() == 1 && destinations.size() == 1, false, "fill_tx_sources_and_destinations failed"); // we selected such good amount so sources.size() and destinations.size() should be eq 1
|
||||
|
||||
// create tx_1 manually in order to have access to its one-time key
|
||||
|
|
@ -1537,7 +1590,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
|
|||
// prepare sources and destinations for tx_2, using the same amount
|
||||
std::vector<tx_source_entry> sources2;
|
||||
std::vector<tx_destination_entry> destinations2;
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources2, destinations2, true, true);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources2, destinations2, true, true);
|
||||
CHECK_AND_ASSERT_MES(r && sources2.size() == 1 && destinations2.size() == 1, false, "fill_tx_sources_and_destinations failed"); // we selected such good amount so sources.size() and destinations.size() should be eq 1
|
||||
|
||||
// tx_2 differs in inputs but should have the same outputs
|
||||
|
|
@ -1578,7 +1631,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
|
|||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
tx_destination_entry de(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
tx_destination_entry de(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_3, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1621,7 +1674,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
|
|||
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
currency::checkpoints checkpoints;
|
||||
checkpoints.add_checkpoint(15, "46f45b849160be33937c60fa564e820792b0aaa6cf4a080e6002b6f25d84d688");
|
||||
checkpoints.add_checkpoint(15, "f7543a7ac52a864dd3782a99229840a38e82fd31b64c6b197a2f41f74bd5bacc");
|
||||
c.set_checkpoints(std::move(checkpoints));
|
||||
|
||||
return true;
|
||||
|
|
@ -1664,11 +1717,11 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
DO_CALLBACK(events, "set_cp");
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 99;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 99;
|
||||
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
|
||||
|
||||
// tx_1: normal input -> multisig output
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1686,7 +1739,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
tx_destination_entry de(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
tx_destination_entry de(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_2, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1702,7 +1755,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
|
||||
|
||||
// tx_3: normal input -> multisig output
|
||||
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_3, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1724,7 +1777,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
se.ms_keys_count = boost::get<txout_multisig>(tx_3.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
de = tx_destination_entry(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
de = tx_destination_entry(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
||||
transaction tx_4 = AUTO_VAL_INIT(tx_4);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_4, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1735,7 +1788,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_acc, tx_4);
|
||||
|
||||
// tx_5: normal input -> multisig output
|
||||
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_5, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1753,7 +1806,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
se.ms_keys_count = boost::get<txout_multisig>(tx_5.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
de = tx_destination_entry(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
de = tx_destination_entry(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
||||
transaction tx_6 = AUTO_VAL_INIT(tx_6);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_6, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1805,11 +1858,11 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 99;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 99;
|
||||
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
|
||||
|
||||
// tx_1: normal key to multisig transaction
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1845,7 +1898,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
events.push_back(tx_3);
|
||||
|
||||
// tx_4: zero ms out keys (should FAIL)
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
tx_builder txb = AUTO_VAL_INIT(txb);
|
||||
txb.step1_init();
|
||||
|
|
@ -1883,7 +1936,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_acc, tx_7);
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE)); // Bob finally got the money
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE)); // Bob finally got the money
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1915,11 +1968,11 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
|
|||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 99;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 99;
|
||||
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
|
||||
|
||||
// tx_1: normal key to multisig transaction
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -1975,7 +2028,7 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
|
|||
// |- (1c)- (2c)- (3c)- <- becomes main chain
|
||||
// tx_1 tx_2
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE));
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // tx_3 should be rejected by the pool, as spending already spent ms output in tx_2
|
||||
events.push_back(tx_3);
|
||||
|
|
@ -1997,7 +2050,7 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
|
|||
// tx_1 tx_2
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(CAROL_ACC_IDX, 0)); // tx_3 was rejected, thus zero
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_tx_pool", params_tx_pool(0));
|
||||
|
||||
|
||||
|
|
@ -2015,12 +2068,12 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
|
|||
// | tx_1 tx_2
|
||||
// \- (3d)- (4d)- (5d)-
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE, 0, 0, amount - TX_DEFAULT_FEE));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE, 0, 0, amount - TESTS_DEFAULT_FEE));
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_6d, blk_5d, miner_acc, tx_2);
|
||||
DO_CALLBACK_PARAMS(events, "check_tx_pool", params_tx_pool(0));
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE, 0, 0, 0, 0));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE, 0, 0, 0, 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2076,9 +2129,9 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
|
|||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 90;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 90;
|
||||
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, alice_acc, amount, TX_DEFAULT_FEE, 4, sources, destinations, true, true, true);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, alice_acc, amount, TESTS_DEFAULT_FEE, 4, sources, destinations, true, true, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -2093,7 +2146,7 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount, 0, 0, 0, 0));
|
||||
|
||||
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount - TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, sources, destinations, true, true, true);
|
||||
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -2103,7 +2156,7 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
|
|||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_2);
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0, 0, 0, 0, 0));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE, 0, 0, 0, 0));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE, 0, 0, 0, 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2139,9 +2192,9 @@ bool ref_by_id_mixed_inputs_types::generate(std::vector<test_event_entry>& event
|
|||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount * 3, 0, 0, 0, 0));
|
||||
|
||||
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, sources, destinations, true, true, false); // normal inputs
|
||||
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, false); // normal inputs
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, sources2, destinations2, true, true, true); // ref_by_id
|
||||
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources2, destinations2, true, true, true); // ref_by_id
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
// mix sources to achive mixed normal and ref_by_id inputs
|
||||
|
|
@ -2173,7 +2226,7 @@ bool ref_by_id_mixed_inputs_types::generate(std::vector<test_event_entry>& event
|
|||
|
||||
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0, 0, 0, 0, 0));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount * 3 - TX_DEFAULT_FEE, 0, 0, 0, 0));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount * 3 - TESTS_DEFAULT_FEE, 0, 0, 0, 0));
|
||||
|
||||
|
||||
return true;
|
||||
|
|
@ -2208,7 +2261,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
// prepare ms data: amount and list of participants' adresses (belived to be publicly available)
|
||||
uint64_t ms_amount = TX_DEFAULT_FEE * 17;
|
||||
uint64_t ms_amount = TESTS_DEFAULT_FEE * 17;
|
||||
std::list<account_public_address> ms_addr_list;
|
||||
for(auto &p : m_participants)
|
||||
ms_addr_list.push_back(p.get_public_address());
|
||||
|
|
@ -2216,7 +2269,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
// Miner makes a tx with ms output to all the participants (with minimum_sigs == m_minimum_signs_to_spend)
|
||||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, ms_amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, m_minimum_signs_to_spend);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, ms_amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, m_minimum_signs_to_spend);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
|
|
@ -2244,7 +2297,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[ms_out_index].target).keys.size();
|
||||
sources.push_back(se);
|
||||
|
||||
tx_destination_entry de(ms_amount - TX_DEFAULT_FEE, alice_acc.get_public_address());
|
||||
tx_destination_entry de(ms_amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address());
|
||||
destinations.push_back(de);
|
||||
|
||||
// construct a transaction (no participants keys are provided, thus no signs for ms input are created)
|
||||
|
|
@ -2271,7 +2324,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
r = generator.refresh_test_wallet(events, alice_wlt.get(), get_block_hash(blk_2), CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
|
||||
|
||||
r = check_balance_via_wallet(*alice_wlt.get(), "alice", ms_amount - TX_DEFAULT_FEE, 0, 0, 0, 0);
|
||||
r = check_balance_via_wallet(*alice_wlt.get(), "alice", ms_amount - TESTS_DEFAULT_FEE, 0, 0, 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "invalid balance");
|
||||
|
||||
return true;
|
||||
|
|
@ -2308,11 +2361,11 @@ bool multisig_out_make_and_spent_in_altchain::generate(std::vector<test_event_en
|
|||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 33;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 33;
|
||||
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
|
||||
|
||||
// tx_1: normal key to multisig transaction
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE * 7, 0, sources, destinations, true, true, 2);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE * 7, 0, sources, destinations, true, true, 2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -2337,7 +2390,7 @@ bool multisig_out_make_and_spent_in_altchain::generate(std::vector<test_event_en
|
|||
|
||||
// tx_2
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TX_DEFAULT_FEE * 13);
|
||||
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TESTS_DEFAULT_FEE * 13);
|
||||
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // simulate
|
||||
events.push_back(tx_2);
|
||||
|
|
@ -2347,7 +2400,7 @@ bool multisig_out_make_and_spent_in_altchain::generate(std::vector<test_event_en
|
|||
|
||||
// tx_3 spends the same ms out
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_3, TX_DEFAULT_FEE * 13);
|
||||
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_3, TESTS_DEFAULT_FEE * 13);
|
||||
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // simulate
|
||||
events.push_back(tx_3);
|
||||
|
|
@ -2387,11 +2440,11 @@ bool multisig_out_spent_in_altchain_case_b4::generate(std::vector<test_event_ent
|
|||
std::vector<tx_source_entry> sources;
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 22;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 22;
|
||||
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
|
||||
|
||||
// tx_1: normal key to multisig transaction
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE * 5, 0, sources, destinations, true, true, 2);
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE * 5, 0, sources, destinations, true, true, 2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
|
|
@ -2414,7 +2467,7 @@ bool multisig_out_spent_in_altchain_case_b4::generate(std::vector<test_event_ent
|
|||
|
||||
// tx_2
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TX_DEFAULT_FEE * 13);
|
||||
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TESTS_DEFAULT_FEE * 13);
|
||||
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
@ -2463,7 +2516,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
|
|||
auto& alice_acc = m_accounts[ALICE_ACC_IDX];
|
||||
auto& bob_acc = m_accounts[BOB_ACC_IDX];
|
||||
|
||||
uint64_t ms_amount = TX_DEFAULT_FEE * 13;
|
||||
uint64_t ms_amount = TESTS_DEFAULT_FEE * 13;
|
||||
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
|
||||
size_t blocks_fetched = 0;
|
||||
|
|
@ -2481,10 +2534,14 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
|
|||
// to_key => multisig
|
||||
dst.back().addr.push_back(miner_acc.get_public_address());
|
||||
dst.back().addr.push_back(alice_acc.get_public_address());
|
||||
dst.back().amount = ms_amount + TX_DEFAULT_FEE;
|
||||
dst.back().amount = ms_amount + TESTS_DEFAULT_FEE;
|
||||
dst.back().minimum_sigs = dst.back().addr.size();
|
||||
transaction key_to_ms_tx = AUTO_VAL_INIT(key_to_ms_tx);
|
||||
<<<<<<< HEAD
|
||||
miner_wlt->transfer(dst, 0, 0, TX_DEFAULT_FEE, extra, attachments, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), key_to_ms_tx);
|
||||
=======
|
||||
miner_wlt->transfer(dst, 0, 0, TESTS_DEFAULT_FEE, extra, attachments, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), key_to_ms_tx);
|
||||
>>>>>>> master
|
||||
|
||||
bool r = mine_next_pow_blocks_in_playtime(miner_acc.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
|
||||
|
|
@ -2521,7 +2578,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
|
|||
multisig_id,
|
||||
dst2,
|
||||
0,
|
||||
TX_DEFAULT_FEE,
|
||||
TESTS_DEFAULT_FEE,
|
||||
extra,
|
||||
attachments,
|
||||
tools::detail::ssi_digit,
|
||||
|
|
|
|||
|
|
@ -263,22 +263,22 @@ bool offers_expiration_test::generate(std::vector<test_event_entry>& events) con
|
|||
od.expiration_time = 0;
|
||||
attachment.clear();
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_0, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_0, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
|
||||
od.expiration_time = 1;
|
||||
attachment.clear();
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_1, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_1, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
|
||||
od.expiration_time = 2;
|
||||
attachment.clear();
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_2, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_2, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
|
||||
od.expiration_time = 3;
|
||||
attachment.clear();
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_3, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_3, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1, tx_2, tx_3 }));
|
||||
m_offers_ts = blk_1.timestamp;
|
||||
|
|
@ -378,7 +378,7 @@ bool offers_filtering_1::generate(std::vector<test_event_entry>& events) const
|
|||
fill_test_offer(od);
|
||||
std::vector<currency::attachment_v> attachment;
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_0r, attachment);
|
||||
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
|
||||
}
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, txs);
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ bool offers_filtering_1::generate(std::vector<test_event_entry>& events) const
|
|||
fill_test_offer(od);
|
||||
std::vector<currency::attachment_v> attachment;
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_1, attachment);
|
||||
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_1, attachment);
|
||||
}
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, txs);
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ bool offers_handling_on_chain_switching::generate(std::vector<test_event_entry>&
|
|||
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time()); // 0
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 2N (N == CURRENCY_MINED_MONEY_UNLOCK_WINDOW)
|
||||
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, TX_DEFAULT_FEE * 70, blk_0r); // 2N+1
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, TESTS_DEFAULT_FEE * 70, blk_0r); // 2N+1
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0); // 2N+2
|
||||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 4N+2
|
||||
|
|
@ -535,7 +535,7 @@ bool offers_handling_on_chain_switching::generate(std::vector<test_event_entry>&
|
|||
fill_test_offer(od);
|
||||
std::vector<currency::attachment_v> attachment;
|
||||
bc_services::put_offer_into_attachment(od, attachment);
|
||||
MAKE_TX_ATTACH(events, tx_1, alice_acc, alice_acc, TX_DEFAULT_FEE, blk_1r, attachment); // 4N+3
|
||||
MAKE_TX_ATTACH(events, tx_1, alice_acc, alice_acc, TESTS_DEFAULT_FEE, blk_1r, attachment); // 4N+3
|
||||
|
||||
MAKE_NEXT_BLOCK(events, blk_2, blk_1r, miner_acc); // 4N+4
|
||||
//MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1); // 4N+4
|
||||
|
|
@ -1255,7 +1255,7 @@ bool offer_lifecycle_via_tx_pool::c1(currency::core& c, size_t ev_index, const s
|
|||
bc_services::offer_details_ex od = AUTO_VAL_INIT(od);
|
||||
fill_test_offer(od);
|
||||
od.comment = "1";
|
||||
od.fee = TX_DEFAULT_FEE * 3;
|
||||
od.fee = TESTS_DEFAULT_FEE * 3;
|
||||
|
||||
// create an offer
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ void decompose_amount_into_exact_number_of_pos_entries(uint64_t amount, size_t p
|
|||
{
|
||||
for (auto it = pos_amounts_list.begin(); it != pos_amounts_list.end() && pos_amounts_list.size() < pos_entries_count; /* nothing */)
|
||||
{
|
||||
if (*it >= 2 * TX_DEFAULT_FEE)
|
||||
if (*it >= 2 * TESTS_DEFAULT_FEE)
|
||||
{
|
||||
// each iteration pops one element 'a' and pushes two elements: c1 and c2, so that a == c1 + c2 (sum is invariant)
|
||||
uint64_t a = *it;
|
||||
|
|
@ -442,7 +442,7 @@ bool populate_wallet_with_stake_coins(std::shared_ptr<tools::wallet2> w, std::sh
|
|||
uint64_t balance_unlocked = 0;
|
||||
uint64_t balance = w->balance(balance_unlocked);
|
||||
CHECK_AND_ASSERT_MES(balance == balance_unlocked, false, "WARNING: balance is " << balance << " NOT EQUAL TO unlocked balance, which is " << balance_unlocked);
|
||||
if (balance_unlocked > TX_DEFAULT_FEE)
|
||||
if (balance_unlocked > TESTS_DEFAULT_FEE)
|
||||
WALLET_TRY_CATCH(w->transfer(balance_unlocked, money_source_w->get_account().get_public_address()));
|
||||
|
||||
uint64_t sum = 0;
|
||||
|
|
@ -453,7 +453,7 @@ bool populate_wallet_with_stake_coins(std::shared_ptr<tools::wallet2> w, std::sh
|
|||
// populate current wallet with pos entries from scratch
|
||||
money_source_w->refresh();
|
||||
balance = money_source_w->balance(balance_unlocked);
|
||||
CHECK_AND_ASSERT_MES(balance_unlocked > amount + TX_DEFAULT_FEE * pos_entries_count, false, "source wallet has not enough money: balance_unlocked: " << balance_unlocked << ", balance: " << balance << ", required amount: " << amount + TX_DEFAULT_FEE * pos_entries_count);
|
||||
CHECK_AND_ASSERT_MES(balance_unlocked > amount + TESTS_DEFAULT_FEE * pos_entries_count, false, "source wallet has not enough money: balance_unlocked: " << balance_unlocked << ", balance: " << balance << ", required amount: " << amount + TESTS_DEFAULT_FEE * pos_entries_count);
|
||||
|
||||
const account_public_address& wallet_address = w->get_account().get_public_address();
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
|
|
@ -461,7 +461,7 @@ bool populate_wallet_with_stake_coins(std::shared_ptr<tools::wallet2> w, std::sh
|
|||
for(auto pos_amount : pos_amounts)
|
||||
destinations.push_back(tx_destination_entry(pos_amount, wallet_address));
|
||||
|
||||
WALLET_TRY_CATCH(money_source_w->transfer(destinations, 0, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment));
|
||||
WALLET_TRY_CATCH(money_source_w->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment));
|
||||
|
||||
return true;
|
||||
|
||||
|
|
@ -885,7 +885,7 @@ bool pos_altblocks_validation::generate(std::vector<test_event_entry>& events) c
|
|||
stake_tx_out_id = i;
|
||||
}
|
||||
|
||||
MAKE_TX_FEE(events, tx_0, alice_acc, alice_acc, alice_money - TX_DEFAULT_FEE * 17, TX_DEFAULT_FEE * 17, blk_2);
|
||||
MAKE_TX_FEE(events, tx_0, alice_acc, alice_acc, alice_money - TESTS_DEFAULT_FEE * 17, TESTS_DEFAULT_FEE * 17, blk_2);
|
||||
// tx_0 transfers all Alice's money, so it effectevily spends all outputs in stake_ts, make sure it does
|
||||
CHECK_AND_ASSERT_MES(tx_0.vin.size() == stake_tx.vout.size(), false, "probably, tx_0 doesn't spend all Alice's money as expected, tx_0.vin.size()=" << tx_0.vin.size() << ", stake_tx.vout.size()=" << stake_tx.vout.size());
|
||||
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ bool gen_tx_signatures_are_invalid::generate(std::vector<test_event_entry>& even
|
|||
MAKE_NEXT_BLOCK(events, blk_1, blk_0, miner_account);
|
||||
REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_account, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
uint64_t amount = TX_DEFAULT_FEE * 80;
|
||||
uint64_t amount = TESTS_DEFAULT_FEE * 80;
|
||||
|
||||
// prepare needed outputs by transferring them to Carol and Dan
|
||||
MAKE_TX(events, tx_a, miner_account, carol_account, amount / 2, blk_1r);
|
||||
|
|
@ -698,7 +698,7 @@ bool gen_tx_signatures_are_invalid::generate(std::vector<test_event_entry>& even
|
|||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, prev_block, miner_account, std::list<transaction>({ tx_0, tx_1 }));
|
||||
|
||||
// spend all Alice's money to make sure she has successfully received it with 'tx'
|
||||
MAKE_TX(events, tx_2, alice_account, bob_account, amount * 2 - TX_DEFAULT_FEE, blk_3);
|
||||
MAKE_TX(events, tx_2, alice_account, bob_account, amount * 2 - TESTS_DEFAULT_FEE, blk_3);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_account, tx_2);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ bool gen_wallet_basic_transfer::generate(std::vector<test_event_entry>& events)
|
|||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, bob_wlt, blk_3, CURRENCY_MINED_MONEY_UNLOCK_WINDOW * 2 + 3);
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, 1);
|
||||
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(900) - TX_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(900) - TX_DEFAULT_FEE));
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(900) - TESTS_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(900) - TESTS_DEFAULT_FEE));
|
||||
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(bob_wlt, MK_TEST_COINS(2100));
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(bob_acc_idx, MK_TEST_COINS(2100)));
|
||||
|
|
@ -217,7 +217,7 @@ bool gen_wallet_refreshing_on_chain_switch::generate(std::vector<test_event_entr
|
|||
|
||||
// alice tries to send some money
|
||||
// MAKE_TEST_WALLET_TX(events, tx_1, alice_wlt, MK_TEST_COINS(1500), miner_acc); - can't use wallet because it checks money unlock
|
||||
MAKE_TX_FEE(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(1500), TX_DEFAULT_FEE, blk_1);
|
||||
MAKE_TX_FEE(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(1500), TESTS_DEFAULT_FEE, blk_1);
|
||||
|
||||
// switch the chain
|
||||
MAKE_NEXT_BLOCK(events, blk_1a, blk_0r, miner_acc);
|
||||
|
|
@ -237,8 +237,8 @@ bool gen_wallet_refreshing_on_chain_switch::generate(std::vector<test_event_entr
|
|||
// Actually we have: total = 2000 + 500 - fee, unlocked = 0, mined = 0, awaiting_in = 2000 + (500 - fee), awaiting_out = 0
|
||||
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2a, 2);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(2500) - TX_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, uint64_max, 0, 0, MK_TEST_COINS(2500) - TX_DEFAULT_FEE, 0));
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(2500) - TESTS_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, uint64_max, 0, 0, MK_TEST_COINS(2500) - TESTS_DEFAULT_FEE, 0));
|
||||
|
||||
// make sure her transaction is not valid now
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -254,8 +254,8 @@ bool gen_wallet_refreshing_on_chain_switch::generate(std::vector<test_event_entr
|
|||
|
||||
// refresh the wallet and make sure it's ok with correct balance
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, 3);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(500) - TX_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(500) - TX_DEFAULT_FEE));
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(500) - TESTS_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(500) - TESTS_DEFAULT_FEE));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -284,10 +284,10 @@ bool gen_wallet_refreshing_on_chain_switch_2::generate(std::vector<test_event_en
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 2N (N = CURRENCY_MINED_MONEY_UNLOCK_WINDOW == 10)
|
||||
|
||||
// send some money to alice
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r); // 2N+1
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r); // 2N+1
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0); // 2N+1
|
||||
|
||||
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TX_DEFAULT_FEE, blk_0r); // 2N+3
|
||||
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TESTS_DEFAULT_FEE, blk_0r); // 2N+3
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_1); // 2N+4
|
||||
|
||||
// 0 10 11 12 <- blockchain height
|
||||
|
|
@ -367,7 +367,7 @@ bool gen_wallet_unconfirmed_tx_from_tx_pool::generate(std::vector<test_event_ent
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
// prepare a tx with money for alice
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
|
||||
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_0r, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
//bool has_aliases = false;
|
||||
|
|
@ -428,7 +428,7 @@ bool gen_wallet_save_load_and_balance::generate(std::vector<test_event_entry>& e
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
// prepare a tx with money for alice
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
|
||||
|
||||
// check balance based on gen-time data
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_0r, 10);
|
||||
|
|
@ -559,7 +559,7 @@ bool gen_wallet_mine_pos_block::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
||||
|
|
@ -631,14 +631,14 @@ bool gen_wallet_unconfirmed_outdated_tx::generate(std::vector<test_event_entry>&
|
|||
|
||||
// create tx_0 like it's 20 sec after blk_0r
|
||||
events.push_back(event_core_time(blk_0r.timestamp + 20));
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(200), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(200), TESTS_DEFAULT_FEE, blk_0r);
|
||||
|
||||
// check balances and populate unconfirmed tx list in a wallet
|
||||
DO_CALLBACK(events, "c1");
|
||||
|
||||
// create tx_1 like it's 25 sec after blk_0r
|
||||
events.push_back(event_core_time(blk_0r.timestamp + 25));
|
||||
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TESTS_DEFAULT_FEE, blk_0r);
|
||||
|
||||
// check balances and populate unconfirmed tx list in a wallet
|
||||
DO_CALLBACK(events, "c2");
|
||||
|
|
@ -787,8 +787,8 @@ bool gen_wallet_unlock_by_block_and_by_time::generate(std::vector<test_event_ent
|
|||
// create two txs (2x 3000 test coins to Alice) both having non-zero unlock_time
|
||||
uint64_t unlock_block_num = CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2 + WALLET_DEFAULT_TX_SPENDABLE_AGE + 2;
|
||||
uint64_t unlock_time = blk_0.timestamp + 10000;
|
||||
miner_wlt->transfer(destinations, 0, unlock_block_num, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_0);
|
||||
miner_wlt->transfer(destinations, 0, unlock_time, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_1);
|
||||
miner_wlt->transfer(destinations, 0, unlock_block_num, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_0);
|
||||
miner_wlt->transfer(destinations, 0, unlock_time, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_1);
|
||||
events.push_back(tx_0);
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -828,7 +828,7 @@ bool gen_wallet_unlock_by_block_and_by_time::generate(std::vector<test_event_ent
|
|||
|
||||
// check the balance, make sure the tx is still locked and money can't be spent
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2, 0);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29));
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29));
|
||||
|
||||
r = false;
|
||||
try
|
||||
|
|
@ -848,7 +848,7 @@ bool gen_wallet_unlock_by_block_and_by_time::generate(std::vector<test_event_ent
|
|||
|
||||
// check balance
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2, 0);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, MK_TEST_COINS(30), 0, MK_TEST_COINS(29));
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, MK_TEST_COINS(30), 0, MK_TEST_COINS(29));
|
||||
|
||||
// make sure the money can be spent now, put a transaction
|
||||
MAKE_TEST_WALLET_TX(events, tx_d, alice_wlt, MK_TEST_COINS(29), miner_acc);
|
||||
|
|
@ -875,7 +875,7 @@ bool gen_wallet_unlock_by_block_and_by_time::c1(currency::core& c, size_t ev_ind
|
|||
bool r = false;
|
||||
try
|
||||
{
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
}
|
||||
catch (const tools::error::not_enough_money&)
|
||||
{
|
||||
|
|
@ -902,7 +902,7 @@ bool gen_wallet_unlock_by_block_and_by_time::c2(currency::core& c, size_t ev_ind
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == 1, false, "Incorrect numbers of blocks fetched");
|
||||
alice_wlt->scan_tx_pool(has_alias);
|
||||
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
|
||||
return false;
|
||||
|
||||
alice_wlt->reset_password(g_wallet_password);
|
||||
|
|
@ -924,13 +924,13 @@ bool gen_wallet_unlock_by_block_and_by_time::c3(currency::core& c, size_t ev_ind
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == 0, false, "Incorrect numbers of blocks fetched");
|
||||
alice_wlt->scan_tx_pool(has_alias);
|
||||
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
|
||||
return false;
|
||||
|
||||
bool r = false;
|
||||
try
|
||||
{
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
}
|
||||
catch (const tools::error::not_enough_money&)
|
||||
{
|
||||
|
|
@ -957,7 +957,7 @@ bool gen_wallet_unlock_by_block_and_by_time::c4(currency::core& c, size_t ev_ind
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == 0, false, "Incorrect numbers of blocks fetched");
|
||||
alice_wlt->scan_tx_pool(has_alias);
|
||||
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29 - 29) - TX_DEFAULT_FEE * 2, 0, 0, 0, MK_TEST_COINS(29 + 29)))
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29 - 29) - TESTS_DEFAULT_FEE * 2, 0, 0, 0, MK_TEST_COINS(29 + 29)))
|
||||
return false;
|
||||
|
||||
alice_wlt->reset_password(g_wallet_password);
|
||||
|
|
@ -1027,8 +1027,8 @@ bool gen_wallet_payment_id::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
CREATE_TEST_WALLET(alice_wlt, alice_acc, blk_0);
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TX_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TX_DEFAULT_FEE));
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TESTS_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TESTS_DEFAULT_FEE));
|
||||
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
alice_wlt->get_payments(m_payment_id, payments);
|
||||
|
|
@ -1058,7 +1058,7 @@ bool gen_wallet_payment_id::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_4a, 2);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1 + 9) - TX_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1 + 9) - TESTS_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0);
|
||||
payments.clear();
|
||||
alice_wlt->get_payments(m_payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 3, false, "Invalid payments count (2)");
|
||||
|
|
@ -1081,7 +1081,7 @@ bool gen_wallet_payment_id::c1(currency::core& c, size_t ev_index, const std::ve
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3, false, "Incorrect numbers of blocks fetched");
|
||||
alice_wlt->scan_tx_pool(has_alias);
|
||||
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(56) - TX_DEFAULT_FEE, 0, 0, 0, 0))
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(56) - TESTS_DEFAULT_FEE, 0, 0, 0, 0))
|
||||
return false;
|
||||
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
|
|
@ -1111,7 +1111,7 @@ bool gen_wallet_payment_id::c2(currency::core& c, size_t ev_index, const std::ve
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == 2, false, "Incorrect numbers of blocks fetched");
|
||||
alice_wlt->scan_tx_pool(has_alias);
|
||||
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(40 + 5 + 7 - 10 + 9 + 13 + 1) - TX_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0))
|
||||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(40 + 5 + 7 - 10 + 9 + 13 + 1) - TESTS_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0))
|
||||
return false;
|
||||
|
||||
|
||||
|
|
@ -1255,8 +1255,8 @@ bool gen_wallet_transfers_and_outdated_unconfirmed_txs::generate(std::vector<tes
|
|||
// make initial transfers to Alice and unlock the money
|
||||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1);
|
||||
|
||||
MAKE_TX_FEE(events, tx_0a, miner_acc, alice_acc, MK_TEST_COINS(300), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0b, miner_acc, alice_acc, MK_TEST_COINS(300), TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0a, miner_acc, alice_acc, MK_TEST_COINS(300), TESTS_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX_FEE(events, tx_0b, miner_acc, alice_acc, MK_TEST_COINS(300), TESTS_DEFAULT_FEE, blk_0r);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0a, tx_0b }));
|
||||
|
||||
REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
|
@ -1269,7 +1269,7 @@ bool gen_wallet_transfers_and_outdated_unconfirmed_txs::generate(std::vector<tes
|
|||
CHECK_AND_ASSERT_MES(trs.size() == 2 && !trs[0].is_spent() && !trs[1].is_spent(), false, "Wrong transfers state");
|
||||
|
||||
// make a tx from outside the wallet, so wallet can't mark used indices
|
||||
MAKE_TX_FEE(events, tx_3, alice_acc, miner_acc, MK_TEST_COINS(290), TX_DEFAULT_FEE, blk_1r);
|
||||
MAKE_TX_FEE(events, tx_3, alice_acc, miner_acc, MK_TEST_COINS(290), TESTS_DEFAULT_FEE, blk_1r);
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_1r, 0);
|
||||
alice_wlt->get_transfers(trs);
|
||||
CHECK_AND_ASSERT_MES(trs.size() == 2 && (trs[0].is_spent() ^ trs[1].is_spent()), false, "Wrong transfers state");
|
||||
|
|
@ -1346,7 +1346,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
CHECK_AND_ASSERT_MES(trs.size() == 2 && !trs[0].is_spent() && !trs[1].is_spent(), false, "Wrong transfers state");
|
||||
|
||||
// make a tx from outside the wallet, so wallet can't mark used indices
|
||||
MAKE_TX(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(30) - TX_DEFAULT_FEE, blk_1r);
|
||||
MAKE_TX(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(30) - TESTS_DEFAULT_FEE, blk_1r);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1);
|
||||
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2, 1);
|
||||
|
|
@ -1354,7 +1354,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
CHECK_AND_ASSERT_MES(trs.size() == 2 && (trs[0].is_spent() ^ trs[1].is_spent()), false, "Wrong transfers state");
|
||||
|
||||
// make a tx via the wallet, so used selected_indicies is populated for associated transfer
|
||||
MAKE_TEST_WALLET_TX(events, tx_2, alice_wlt, MK_TEST_COINS(30) - TX_DEFAULT_FEE, miner_acc);
|
||||
MAKE_TEST_WALLET_TX(events, tx_2, alice_wlt, MK_TEST_COINS(30) - TESTS_DEFAULT_FEE, miner_acc);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_2);
|
||||
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, 1);
|
||||
|
|
@ -1376,8 +1376,8 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
alice_wlt->get_transfers(trs);
|
||||
CHECK_AND_ASSERT_MES(trs.size() == 2 && trs[0].is_spent() && trs[1].is_spent(), false, "Wrong transfers state");
|
||||
|
||||
// fast forward time to make txs outdated
|
||||
test_core_time::adjust(test_core_time::get_time() + CURRENCY_MEMPOOL_TX_LIVETIME + 1);
|
||||
// fast forward time to make tx_1 and tx_2 outdated (blk_3 is the block where tx_2 came with)
|
||||
test_core_time::adjust(get_actual_timestamp(blk_3) + CURRENCY_MEMPOOL_TX_LIVETIME + 1);
|
||||
|
||||
MAKE_NEXT_BLOCK(events, blk_5a, blk_4a, miner_acc);
|
||||
|
||||
|
|
@ -1589,9 +1589,9 @@ bool gen_wallet_alias_and_unconfirmed_txs::generate(std::vector<test_event_entry
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "alicealice";
|
||||
ai.m_address = alice_acc.get_public_address();
|
||||
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_alice_alias, miner_acc, null_account, get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE), TX_DEFAULT_FEE, 0, blk_0r, 0, std::vector<currency::extra_v>({ ai }), true);
|
||||
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_alice_alias, miner_acc, null_account, get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE), TESTS_DEFAULT_FEE, 0, blk_0r, 0, std::vector<currency::extra_v>({ ai }), true);
|
||||
|
||||
uint64_t amount = get_alias_coast_from_fee(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), TX_DEFAULT_FEE);
|
||||
uint64_t amount = get_alias_coast_from_fee(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), TESTS_DEFAULT_FEE);
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, amount, blk_0r);
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, amount, blk_0r);
|
||||
MAKE_TX(events, tx_2, miner_acc, bob_acc, amount, blk_0r);
|
||||
|
|
@ -1624,7 +1624,7 @@ bool gen_wallet_alias_and_unconfirmed_txs::c1(currency::core& c, size_t ev_index
|
|||
ai.m_address = m_accounts[BOB_ACC_IDX].get_public_address();
|
||||
ai.m_view_key.push_back(m_accounts[BOB_ACC_IDX].get_keys().m_view_secret_key);
|
||||
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
|
||||
bool r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", alias_reward * 2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Incorrect wallet balance");
|
||||
|
||||
|
|
@ -1661,7 +1661,7 @@ bool gen_wallet_alias_and_unconfirmed_txs::c2(currency::core& c, size_t ev_index
|
|||
ai.m_address = someone.get_public_address();
|
||||
ai.m_view_key.push_back(someone.get_keys().m_view_secret_key);
|
||||
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
|
||||
bool r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", alias_reward * 2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Incorrect wallet balance");
|
||||
|
||||
|
|
@ -1737,10 +1737,10 @@ bool gen_wallet_alias_via_special_wallet_funcs::generate(std::vector<test_event_
|
|||
|
||||
REWIND_BLOCKS_N(events, blk_0r, blk_00, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TX_DEFAULT_FEE);
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, biggest_alias_reward + TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, biggest_alias_reward + TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX(events, tx_2, miner_acc, alice_acc, biggest_alias_reward + TX_DEFAULT_FEE, blk_0r);
|
||||
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TESTS_DEFAULT_FEE);
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, biggest_alias_reward + TESTS_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, biggest_alias_reward + TESTS_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX(events, tx_2, miner_acc, alice_acc, biggest_alias_reward + TESTS_DEFAULT_FEE, blk_0r);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1, tx_2 }));
|
||||
|
||||
|
|
@ -1763,9 +1763,9 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "alicealice";
|
||||
ai.m_address = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
|
||||
transaction res_tx = AUTO_VAL_INIT(res_tx);
|
||||
alice_wlt->request_alias_registration(ai, res_tx, TX_DEFAULT_FEE, alias_reward);
|
||||
alice_wlt->request_alias_registration(ai, res_tx, TESTS_DEFAULT_FEE, alias_reward);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -1775,7 +1775,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
|
|||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
CHECK_AND_ASSERT_MES(c.get_current_blockchain_size() == 2 + CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1 + WALLET_DEFAULT_TX_SPENDABLE_AGE + 1, false, "Incorrect blockchain size");
|
||||
|
||||
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TX_DEFAULT_FEE);
|
||||
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TESTS_DEFAULT_FEE);
|
||||
std::shared_ptr<wlt_lambda_on_transfer2_wrapper> l(new wlt_lambda_on_transfer2_wrapper(
|
||||
[biggest_alias_reward](const tools::wallet_rpc::wallet_transfer_info& wti) -> bool {
|
||||
return std::count(wti.recipients_aliases.begin(), wti.recipients_aliases.end(), "minerminer") == 1 &&
|
||||
|
|
@ -1786,7 +1786,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
|
|||
|
||||
transaction t;
|
||||
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(biggest_alias_reward, m_accounts[MINER_ACC_IDX].get_public_address()));
|
||||
alice_wlt->transfer(destinations, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), t);
|
||||
alice_wlt->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), t);
|
||||
CHECK_AND_ASSERT_MES(l->m_result, false, "Wrong wti received via callback");
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
|
@ -1800,7 +1800,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
|
|||
|
||||
ai.m_text_comment = "Update!";
|
||||
ai.m_address = m_accounts[MINER_ACC_IDX].get_public_address();
|
||||
alice_wlt->request_alias_update(ai, res_tx, TX_DEFAULT_FEE, 0);
|
||||
alice_wlt->request_alias_update(ai, res_tx, TESTS_DEFAULT_FEE, 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -1893,9 +1893,9 @@ bool gen_wallet_fake_outputs_randomness::c1(currency::core& c, size_t ev_index,
|
|||
miner_wlt->set_core_proxy(m_core_proxy);
|
||||
|
||||
|
||||
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TX_DEFAULT_FEE, m_accounts[ALICE_ACC_IDX].get_public_address()));
|
||||
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TESTS_DEFAULT_FEE, m_accounts[ALICE_ACC_IDX].get_public_address()));
|
||||
transaction tx;
|
||||
miner_wlt->transfer(dest, fake_outputs_count, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
|
||||
miner_wlt->transfer(dest, fake_outputs_count, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
|
||||
|
||||
std::vector<size_t> r_ins;
|
||||
bool r = determine_tx_real_inputs(c, tx, m_accounts[MINER_ACC_IDX].get_keys(), r_ins);
|
||||
|
|
@ -1989,9 +1989,9 @@ bool gen_wallet_fake_outputs_not_enough::c1(currency::core& c, size_t ev_index,
|
|||
|
||||
size_t fake_outputs_count = 3;
|
||||
|
||||
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_no_outs_have - TX_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()));
|
||||
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_no_outs_have - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()));
|
||||
transaction tx;
|
||||
alice_wlt->transfer(dest, fake_outputs_count, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
|
||||
alice_wlt->transfer(dest, fake_outputs_count, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
|
||||
|
||||
std::vector<size_t> r_ins;
|
||||
r = determine_tx_real_inputs(c, tx, m_accounts[ALICE_ACC_IDX].get_keys(), r_ins);
|
||||
|
|
@ -2060,11 +2060,11 @@ bool gen_wallet_offers_basic::c1(currency::core& c, size_t ev_index, const std::
|
|||
bc_services::offer_details_ex od1 = AUTO_VAL_INIT(od1);
|
||||
fill_test_offer(od1);
|
||||
od1.deal_option = "OFFER 1";
|
||||
od1.fee = TX_DEFAULT_FEE;
|
||||
od1.fee = TESTS_DEFAULT_FEE;
|
||||
bc_services::offer_details_ex od2 = AUTO_VAL_INIT(od2);
|
||||
fill_test_offer(od2);
|
||||
od2.deal_option = "OFFER 2";
|
||||
od2.fee = TX_DEFAULT_FEE;
|
||||
od2.fee = TESTS_DEFAULT_FEE;
|
||||
|
||||
transaction tx_o1, tx_o2;
|
||||
miner_wlt->push_offer(od1, tx_o1);
|
||||
|
|
@ -2257,12 +2257,12 @@ bool gen_wallet_offers_size_limit::c1(currency::core& c, size_t ev_index, const
|
|||
bc_services::offer_details_ex od_normal = AUTO_VAL_INIT(od_normal);
|
||||
bool r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 2048, CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 1024, od_normal); // generate biggest offer but within tx size limits
|
||||
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
|
||||
od_normal.fee = TX_DEFAULT_FEE;
|
||||
od_normal.fee = TESTS_DEFAULT_FEE;
|
||||
|
||||
bc_services::offer_details_ex od_oversized = AUTO_VAL_INIT(od_oversized);
|
||||
r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE, CURRENCY_MAX_TRANSACTION_BLOB_SIZE + 1024, od_oversized);
|
||||
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
|
||||
od_oversized.fee = TX_DEFAULT_FEE;
|
||||
od_oversized.fee = TESTS_DEFAULT_FEE;
|
||||
|
||||
// switch off logging during these calls to avoid flooding
|
||||
int log_level = log_space::get_set_log_detalisation_level();
|
||||
|
|
@ -2369,7 +2369,7 @@ bool gen_wallet_dust_to_account::c1(currency::core& c, size_t ev_index, const st
|
|||
|
||||
uint64_t amount = 123.456789 * (float)DEFAULT_DUST_THRESHOLD;
|
||||
miner_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(amount, m_accounts[ALICE_ACC_IDX].get_public_address()) }),
|
||||
0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tools::detail::digit_split_strategy, dust_policy);
|
||||
0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tools::detail::digit_split_strategy, dust_policy);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -2492,9 +2492,9 @@ bool gen_wallet_selecting_pos_entries::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
std::vector<tx_destination_entry> dst({
|
||||
tx_destination_entry(m_amount - 0, m_accounts[MINER_ACC_IDX].get_public_address()),
|
||||
tx_destination_entry(m_amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address())
|
||||
tx_destination_entry(m_amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address())
|
||||
});
|
||||
alice_wlt->transfer(dst, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
alice_wlt->transfer(dst, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -2566,8 +2566,8 @@ bool gen_wallet_spending_coinstake_after_minting::c1(currency::core& c, size_t e
|
|||
//CHECK_AND_ASSERT_MES(blocks_fetched == 1, false, "Incorrect number of blocks fetched");
|
||||
//CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(m_amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) }),
|
||||
0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(m_amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) }),
|
||||
0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -2611,7 +2611,7 @@ bool gen_wallet_fake_outs_while_having_too_little_own_outs::generate(std::vector
|
|||
|
||||
m_amount_many_outs_have = get_outs_money_amount(blk_0r.miner_tx);
|
||||
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, m_amount_many_outs_have + TX_DEFAULT_FEE, blk_0r);
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, m_amount_many_outs_have + TESTS_DEFAULT_FEE, blk_0r);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE + 6);
|
||||
|
|
@ -2649,9 +2649,9 @@ bool gen_wallet_fake_outs_while_having_too_little_own_outs::c1(currency::core& c
|
|||
alice_wlt->set_core_runtime_config(c.get_blockchain_storage().get_core_runtime_config());
|
||||
alice_wlt->set_core_proxy(m_core_proxy);
|
||||
|
||||
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()));
|
||||
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()));
|
||||
transaction tx;
|
||||
alice_wlt->transfer(dest, fake_outputs_count, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
|
||||
alice_wlt->transfer(dest, fake_outputs_count, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
|
||||
|
||||
std::vector<size_t> r_ins;
|
||||
bool r = determine_tx_real_inputs(c, tx, m_accounts[ALICE_ACC_IDX].get_keys(), r_ins);
|
||||
|
|
@ -2813,7 +2813,7 @@ bool premine_wallet_test::check_wallet(currency::core& c, const wchar_t* wallet_
|
|||
return false;
|
||||
|
||||
alice_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(COIN * 1, m_accounts[MINER_ACC_IDX].get_public_address()) }),
|
||||
0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Transfer was unsuccessfull.");
|
||||
|
||||
|
|
@ -3122,3 +3122,95 @@ bool wallet_unconfirmed_tx_expiration::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
wallet_chain_switch_with_spending_the_same_ki::wallet_chain_switch_with_spending_the_same_ki()
|
||||
{
|
||||
REGISTER_CALLBACK_METHOD(wallet_chain_switch_with_spending_the_same_ki, c1);
|
||||
}
|
||||
|
||||
bool wallet_chain_switch_with_spending_the_same_ki::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
// Test outline
|
||||
// 1. A wallet has one unspent output
|
||||
// 2. wallet2::transfer() creates tx_0 that spends wallet's output
|
||||
// 3. tx_0 is successfully put into the blockchain
|
||||
// 4. Due to chain switch tx_0 is removed from the blockchain and get into the transaction pool
|
||||
// 5. Make sure the wallet can't spend that output
|
||||
// 6. After tx is expired make sure the wallet can spend that output
|
||||
|
||||
|
||||
m_accounts.resize(TOTAL_ACCS_COUNT);
|
||||
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
|
||||
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate();
|
||||
account_base& bob_acc = m_accounts[BOB_ACC_IDX]; bob_acc.generate();
|
||||
|
||||
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
|
||||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
MAKE_TX(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(30), blk_0r);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
||||
// rewind blocks to allow wallet be able to spend the coins
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
||||
DO_CALLBACK(events, "c1");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wallet_chain_switch_with_spending_the_same_ki::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
bool r = false;
|
||||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, ALICE_ACC_IDX);
|
||||
|
||||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, MK_TEST_COINS(30), true, UINT64_MAX, MK_TEST_COINS(30)), false, "");
|
||||
|
||||
std::vector<tx_destination_entry> destinations { tx_destination_entry(MK_TEST_COINS(30) - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()) };
|
||||
try
|
||||
{
|
||||
// create tx_1
|
||||
alice_wlt->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment);
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(false, false, "alice_wlt->transfer() caused an exception: " << e.what());
|
||||
}
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Tx pool has incorrect number of txs: " << c.get_pool_transactions_count());
|
||||
|
||||
// mine blk_2 on height 22
|
||||
CHECK_AND_ASSERT_MES(mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c), false, "");
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Tx pool has incorrect number of txs: " << c.get_pool_transactions_count());
|
||||
|
||||
// refresh wallet
|
||||
alice_wlt->refresh();
|
||||
// DO NOT scan_tx_pool here intentionally
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt, "Alice", MK_TEST_COINS(0)), false, "");
|
||||
|
||||
uint64_t blk_1r_height = c.get_top_block_height() - 1;
|
||||
crypto::hash blk_1r_id = c.get_block_id_by_height(blk_1r_height);
|
||||
block blk_2a = AUTO_VAL_INIT(blk_2a);
|
||||
r = mine_next_pow_block_in_playtime_with_given_txs(m_accounts[MINER_ACC_IDX].get_public_address(), c, std::vector<transaction>(), blk_1r_id, blk_1r_height + 1, &blk_2a);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_block_in_playtime_with_given_txs failed");
|
||||
|
||||
// one more to trigger chain switch
|
||||
block blk_3a = AUTO_VAL_INIT(blk_3a);
|
||||
r = mine_next_pow_block_in_playtime_with_given_txs(m_accounts[MINER_ACC_IDX].get_public_address(), c, std::vector<transaction>(), get_block_hash(blk_2a), get_block_height(blk_2a) + 1, &blk_3a);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_block_in_playtime_with_given_txs failed");
|
||||
|
||||
// make sure tx_1 has been moved back to the pool
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
CHECK_AND_ASSERT_MES(c.get_alternative_blocks_count() == 1, false, "Incorrect alt blocks count: " << c.get_alternative_blocks_count());
|
||||
|
||||
//const transaction& tx_1 = boost::get<transaction>(events[4 * CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3]);
|
||||
|
||||
// refresh wallet
|
||||
alice_wlt->refresh();
|
||||
// DO NOT scan_tx_pool here intentionally
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt, "Alice", MK_TEST_COINS(0)), false, "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,3 +237,10 @@ struct wallet_unconfirmed_tx_expiration : public wallet_test
|
|||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
};
|
||||
|
||||
struct wallet_chain_switch_with_spending_the_same_ki : public wallet_test
|
||||
{
|
||||
wallet_chain_switch_with_spending_the_same_ki();
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue