forked from lthn/blockchain
Merge branch 'ui_develop' into issue207
This commit is contained in:
commit
acda8f911b
24 changed files with 291 additions and 70 deletions
|
|
@ -15,7 +15,7 @@ Be sure to properly clone the repository:
|
|||
|--|--|--|--|
|
||||
| gcc (Linux) | 5.4.0 | 7.2.0 | 8.3.0 |
|
||||
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
|
||||
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2015 (14.0 update 1) | 2015 (14.0 update 3) | 2017 (15.5.7) |
|
||||
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2015 (14.0 update 1) | 2017 (15.5.7) | 2019 |
|
||||
| [XCode](https://developer.apple.com/downloads/) (macOS) | 7.3.1 | 9.2 | 9.2 |
|
||||
| [CMake](https://cmake.org/download/) | 2.8.6 | 3.15.5 | 3.15.5 |
|
||||
| [Boost](https://www.boost.org/users/download/) | 1.56 | 1.68 | 1.68 |
|
||||
|
|
|
|||
|
|
@ -132,8 +132,10 @@ extern int cacheflush(char *addr, int nbytes, int cache);
|
|||
|
||||
#ifdef _WIN32
|
||||
typedef int64_t off64_t;
|
||||
#else
|
||||
#elif __APPLE__
|
||||
typedef off_t off64_t;
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
75
snap/snapcraft.yaml
Normal file
75
snap/snapcraft.yaml
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
name: zano
|
||||
base: core18
|
||||
adopt-info: zano
|
||||
summary: "Zano coin: official wallet. Secure. Scalable. Easy to Use."
|
||||
description: |
|
||||
Zano is a scalable and secure coin, designed for use in e-commerce.
|
||||
The technology behind our blockchain provides reliability, security,
|
||||
and flexibility a perfect option for P2P transactions.
|
||||
More info: http://zano.org
|
||||
grade: stable
|
||||
confinement: strict
|
||||
|
||||
architectures:
|
||||
- build-on: amd64
|
||||
- build-on: i386
|
||||
|
||||
parts:
|
||||
zano:
|
||||
source: https://github.com/hyle-team/zano.git
|
||||
plugin: cmake
|
||||
override-pull: |
|
||||
snapcraftctl pull
|
||||
snapcraftctl set-version "$(git describe)"
|
||||
configflags:
|
||||
- -DBUILD_GUI=TRUE
|
||||
override-build: |
|
||||
snapcraftctl build
|
||||
mkdir -p $SNAPCRAFT_PART_INSTALL/opt/Zano
|
||||
cp $SNAPCRAFT_PART_BUILD/src/Zano $SNAPCRAFT_PART_INSTALL/opt/Zano/
|
||||
cp $SNAPCRAFT_PART_BUILD/src/simplewallet $SNAPCRAFT_PART_INSTALL/opt/Zano/
|
||||
cp $SNAPCRAFT_PART_BUILD/src/zanod $SNAPCRAFT_PART_INSTALL/opt/Zano/
|
||||
rsync -a $SNAPCRAFT_PART_SRC/src/gui/qt-daemon/html $SNAPCRAFT_PART_INSTALL/opt/Zano --exclude less --exclude package.json --exclude gulpfile.js
|
||||
build-packages:
|
||||
- make
|
||||
- g++
|
||||
- libboost-all-dev
|
||||
- qtwebengine5-dev
|
||||
- rsync
|
||||
build-attributes: [keep-execstack]
|
||||
stage-packages:
|
||||
- libboost-system1.65.1
|
||||
- libboost-filesystem1.65.1
|
||||
- libboost-thread1.65.1
|
||||
- libboost-date-time1.65.1
|
||||
- libboost-chrono1.65.1
|
||||
- libboost-regex1.65.1
|
||||
- libboost-serialization1.65.1
|
||||
- libboost-program-options1.65.1
|
||||
- libboost-locale1.65.1
|
||||
|
||||
apps:
|
||||
zano:
|
||||
command: opt/Zano/Zano --data-dir $SNAP_USER_COMMON
|
||||
extensions:
|
||||
- kde-neon
|
||||
plugs:
|
||||
- network
|
||||
- home
|
||||
- desktop
|
||||
- opengl #for QML support
|
||||
- browser-support #for Qt WebEngine support
|
||||
- audio-playback
|
||||
- unity7 #for tray icon support
|
||||
simplewallet:
|
||||
command: opt/Zano/simplewallet
|
||||
plugs:
|
||||
- network
|
||||
- home
|
||||
zanod:
|
||||
command: opt/Zano/zanod --data-dir $SNAP_USER_COMMON
|
||||
environment:
|
||||
LC_ALL: C
|
||||
plugs:
|
||||
- network
|
||||
- network-bind
|
||||
|
|
@ -826,6 +826,11 @@ bool MainWindow::money_transfer(const view::transfer_event_info& tei)
|
|||
//don't show unconfirmed tx
|
||||
if (tei.ti.height == 0)
|
||||
return true;
|
||||
if (tei.is_wallet_in_sync_process)
|
||||
{
|
||||
//don't show notification if it long sync process(mmight cause system freeze)
|
||||
return true;
|
||||
}
|
||||
|
||||
auto amount_str = currency::print_money(tei.ti.amount);
|
||||
std::string title, msg;
|
||||
|
|
@ -941,9 +946,12 @@ QString MainWindow::set_localization_strings(const QString param)
|
|||
else
|
||||
{
|
||||
m_localization = lr.strings;
|
||||
m_quit_action->setText(QString().fromUtf8(m_localization[localization_id_quit].c_str()));
|
||||
m_restore_action->setText(QString().fromUtf8(m_localization[localization_id_tray_menu_show].c_str()));
|
||||
m_minimize_action->setText(QString().fromUtf8(m_localization[localization_id_tray_menu_minimize].c_str()));
|
||||
if(m_quit_action)
|
||||
m_quit_action->setText(QString::fromStdString(m_localization[localization_id_quit]));
|
||||
if(m_restore_action)
|
||||
m_restore_action->setText(QString::fromStdString(m_localization[localization_id_tray_menu_show]));
|
||||
if(m_minimize_action)
|
||||
m_minimize_action->setText(QString::fromStdString(m_localization[localization_id_tray_menu_minimize]));
|
||||
resp.error_code = API_RETURN_CODE_OK;
|
||||
LOG_PRINT_L0("New localization set, language title: " << lr.language_title << ", strings " << lr.strings.size());
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -14,6 +14,7 @@ export class Wallet {
|
|||
tracking_hey: string;
|
||||
is_auditable: boolean;
|
||||
is_watch_only: boolean;
|
||||
exclude_mining_txs: boolean;
|
||||
alias_available: boolean;
|
||||
|
||||
alias?: object;
|
||||
|
|
|
|||
|
|
@ -629,11 +629,12 @@ export class BackendService {
|
|||
}
|
||||
}
|
||||
|
||||
getRecentTransfers( id, offset, count, callback) {
|
||||
getRecentTransfers( id, offset, count,exclude_mining_txs, callback) {
|
||||
const params = {
|
||||
wallet_id: id,
|
||||
offset: offset,
|
||||
count: count
|
||||
count: count,
|
||||
exclude_mining_txs: exclude_mining_txs
|
||||
};
|
||||
this.runCommand('get_recent_transfers', params, callback);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {ModalService} from './_helpers/services/modal.service';
|
|||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
|
||||
intervalUpdatePriceState;
|
||||
intervalUpdateContractsState;
|
||||
expMedTsEvent;
|
||||
|
|
@ -248,6 +248,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
|
||||
const wallet = this.variablesService.getWallet(wallet_id);
|
||||
if (wallet) {
|
||||
if(wallet.history.length > 40) {
|
||||
wallet.history.splice(0, 1);
|
||||
}
|
||||
this.ngZone.run(() => {
|
||||
|
||||
if (!wallet.loaded) {
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||
new_wallet.is_auditable = open_data['wi'].is_auditable;
|
||||
new_wallet.is_watch_only = open_data['wi'].is_watch_only;
|
||||
new_wallet.currentPage = 1;
|
||||
new_wallet.exclude_mining_txs = false;
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.total_history_item = open_data.recent_history.total_history_items;
|
||||
new_wallet.totalPages = Math.ceil( open_data.recent_history.total_history_items / this.variablesService.count);
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ export class OpenWalletModalComponent implements OnInit {
|
|||
new_wallet.is_auditable = open_data['wi'].is_auditable;
|
||||
new_wallet.is_watch_only = open_data['wi'].is_watch_only;
|
||||
new_wallet.currentPage = 1;
|
||||
new_wallet.exclude_mining_txs = false;
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.total_history_item = open_data.recent_history.total_history_items;
|
||||
new_wallet.totalPages = Math.ceil( open_data.recent_history.total_history_items / this.variablesService.count);
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
|
|||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
new_wallet.currentPage = 1;
|
||||
new_wallet.exclude_mining_txs = false;
|
||||
new_wallet.is_auditable = open_data['wi'].is_auditable;
|
||||
new_wallet.is_watch_only = open_data['wi'].is_watch_only;
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
Watch-only
|
||||
</div>
|
||||
<div class="content auditable-watch-only" *ngIf="wallet.is_auditable && wallet.is_watch_only">
|
||||
Auditable Watch-Only
|
||||
Tracking
|
||||
</div>
|
||||
</div>
|
||||
<div class="close-wallet-wrapper">
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
<div class="tabs">
|
||||
<div class="tabs-header">
|
||||
<ng-container *ngFor="let tab of tabs; let index = index">
|
||||
<div class="tab" [class.active]="tab.active"
|
||||
<div class="tab" [class.active]="tab.active" [ngClass]="{ 'hide': ((tab.link === '/send' || tab.link === '/contracts') && variablesService.currentWallet.is_watch_only && variablesService.currentWallet.is_auditable) }"
|
||||
[class.disabled]="((tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded))
|
||||
|| ((tab.link === '/send' || tab.link === '/contracts') && variablesService.currentWallet.is_watch_only && variablesService.currentWallet.is_auditable)"
|
||||
(click)="changeTab(index)" (mouseover)="itemHovered(index, true)" (mouseleave)="itemHovered(index, false)">
|
||||
|
|
@ -50,12 +50,26 @@
|
|||
</div>
|
||||
<div *ngIf="activeTab === 'history'" class="pagination-wrapper">
|
||||
<div class="pagination">
|
||||
<div>
|
||||
<button [disabled]="variablesService.currentWallet.currentPage === 1" (click)="setPage(variablesService.currentWallet.currentPage - 1)"><</button>
|
||||
<ng-container *ngFor="let page of variablesService.currentWallet.pages">
|
||||
<button [ngClass]="{ 'active': variablesService.currentWallet.currentPage === page }"
|
||||
(click)="setPage(page)">{{page}}</button>
|
||||
<ng-container *ngIf="!mining">
|
||||
<button *ngFor="let page of variablesService.currentWallet.pages" [ngClass]="{ 'active': variablesService.currentWallet.currentPage === page }"
|
||||
(click)="setPage(page)">{{page}}</button>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="mining">
|
||||
<button [ngClass]="{ 'active': variablesService.currentWallet.currentPage }"
|
||||
(click)="setPage(variablesService.currentWallet.currentPage)">{{variablesService.currentWallet.currentPage}}</button>
|
||||
</ng-container>
|
||||
<button [disabled]="variablesService.currentWallet.currentPage === variablesService.currentWallet.totalPages" (click)="setPage(variablesService.currentWallet.currentPage + 1)">></button>
|
||||
</div>
|
||||
<div class="mining-transaction-switch">
|
||||
<span class="switch-text">Hide mining transactions</span>
|
||||
<div class="switch" (click)="toggleMiningTransactions(); $event.stopPropagation()">
|
||||
<span class="option" *ngIf="mining">{{ 'STAKING.SWITCH.ON' | translate }}</span>
|
||||
<span class="circle" [class.on]="mining" [class.off]="!mining"></span>
|
||||
<span class="option" *ngIf="!mining">{{ 'STAKING.SWITCH.OFF' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -160,19 +160,21 @@
|
|||
cursor: pointer;
|
||||
padding: 0 1rem;
|
||||
height: 5rem;
|
||||
|
||||
&.hide {
|
||||
display: none;
|
||||
}
|
||||
.animated {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-right: 1.3rem;
|
||||
}
|
||||
|
||||
|
||||
.animated ::ng-deep svg {
|
||||
|
||||
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
|
||||
|
||||
path, circle, polygon {
|
||||
fill: #4db1ff;
|
||||
}
|
||||
|
|
@ -239,10 +241,13 @@
|
|||
overflow-y: overlay;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.pagination-wrapper {
|
||||
.pagination {
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
button {
|
||||
margin-right: 0.5rem;
|
||||
padding: 0;
|
||||
|
|
@ -253,3 +258,37 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mining-transaction-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.switch-text {
|
||||
margin-right: 1rem;
|
||||
font-size: 1.3rem;
|
||||
color: #565c62;
|
||||
}
|
||||
|
||||
.switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-radius: 1rem;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
padding: 0.5rem;
|
||||
width: 5rem;
|
||||
height: 2rem;
|
||||
|
||||
.circle {
|
||||
border-radius: 1rem;
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
}
|
||||
|
||||
.option {
|
||||
margin: 0 0.2rem;
|
||||
line-height: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
copyAnimationTimeout;
|
||||
balanceTooltip;
|
||||
activeTab = 'history';
|
||||
public mining:boolean = false;
|
||||
|
||||
public currentPage = 1;
|
||||
|
||||
|
|
@ -104,6 +105,7 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
this.scrolledContent.nativeElement.scrollTop = 0;
|
||||
clearTimeout(this.copyAnimationTimeout);
|
||||
this.copyAnimation = false;
|
||||
this.mining = this.variablesService.currentWallet.exclude_mining_txs;
|
||||
});
|
||||
this.subRouting2 = this.router.events.subscribe(val => {
|
||||
if (val instanceof RoutesRecognized) {
|
||||
|
|
@ -194,10 +196,20 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
this.variablesService.currentWallet.currentPage = pageNumber;
|
||||
this.getRecentTransfers();
|
||||
}
|
||||
toggleMiningTransactions() {
|
||||
this.mining = !this.mining;
|
||||
this.variablesService.currentWallet.exclude_mining_txs = this.mining;
|
||||
this.variablesService.currentWallet.currentPage = 1;
|
||||
this.getRecentTransfers();
|
||||
}
|
||||
|
||||
getRecentTransfers () {
|
||||
this.backend.getRecentTransfers(
|
||||
this.walletID,
|
||||
(this.variablesService.currentWallet.currentPage - 1) * this.variablesService.count,
|
||||
this.variablesService.count, (status, data) => {
|
||||
this.variablesService.count, this.variablesService.currentWallet.exclude_mining_txs, (status, data) => {
|
||||
if (status && data.total_history_items) {
|
||||
this.variablesService.currentWallet.history.splice(0, this.variablesService.currentWallet.history.length);
|
||||
this.ngZone.run(() => {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
#define PROJECT_REVISION "7"
|
||||
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
|
||||
|
||||
#define PROJECT_VERSION_BUILD_NO 97
|
||||
#define PROJECT_VERSION_BUILD_NO 103
|
||||
#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 "]"
|
||||
|
|
|
|||
|
|
@ -356,6 +356,7 @@ public:
|
|||
uint64_t balance;
|
||||
uint64_t total_mined;
|
||||
uint64_t wallet_id;
|
||||
bool is_wallet_in_sync_process;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(ti)
|
||||
|
|
@ -363,6 +364,7 @@ public:
|
|||
KV_SERIALIZE(balance)
|
||||
KV_SERIALIZE(total_mined)
|
||||
KV_SERIALIZE(wallet_id)
|
||||
KV_SERIALIZE(is_wallet_in_sync_process)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
|
@ -408,6 +410,7 @@ public:
|
|||
KV_SERIALIZE(wallet_id)
|
||||
KV_SERIALIZE(offset)
|
||||
KV_SERIALIZE(count)
|
||||
KV_SERIALIZE(exclude_mining_txs)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ void wallet2::init(const std::string& daemon_address)
|
|||
{
|
||||
m_miner_text_info = PROJECT_VERSION_LONG;
|
||||
m_core_proxy->set_connection_addr(daemon_address);
|
||||
m_core_proxy->check_connection();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::set_core_proxy(const std::shared_ptr<i_core_proxy>& proxy)
|
||||
|
|
@ -327,42 +328,12 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
const currency::txin_to_key& intk = boost::get<currency::txin_to_key>(in);
|
||||
|
||||
// check if this input spends our output
|
||||
//transfer_details* p_td = nullptr;
|
||||
uint64_t tid = UINT64_MAX;
|
||||
|
||||
if (is_auditable() && is_watch_only())
|
||||
{
|
||||
// auditable wallet
|
||||
// try to find a reference among own UTXOs
|
||||
std::vector<txout_v> abs_key_offsets = relative_output_offsets_to_absolute(intk.key_offsets); // potential speed-up: don't convert to abs offsets as we interested only in direct spends for auditable wallets. Now it's kind a bit paranoid.
|
||||
for(auto v : abs_key_offsets)
|
||||
{
|
||||
if (v.type() != typeid(uint64_t))
|
||||
continue;
|
||||
uint64_t gindex = boost::get<uint64_t>(v);
|
||||
auto it = m_amount_gindex_to_transfer_id.find(std::make_pair(intk.amount, gindex));
|
||||
if (it != m_amount_gindex_to_transfer_id.end())
|
||||
{
|
||||
tid = it->second;
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(tid < m_transfers.size(), "invalid tid: " << tid << ", ref from input with amount: " << intk.amount << ", gindex: " << gindex);
|
||||
auto& td = m_transfers[it->second];
|
||||
if (intk.key_offsets.size() != 1)
|
||||
{
|
||||
// own output was used in non-direct transaction
|
||||
// the core should not allow this to happen, the only way it may happen - mixing in own output that was sent without mix_attr == 1
|
||||
// log strange situation
|
||||
std::stringstream ss;
|
||||
ss << "own transfer tid=" << tid << " tx=" << td.tx_hash() << " mix_attr=" << td.mix_attr() << ", is referenced by a transaction with mixins, ref from input with amount: " << intk.amount << ", gindex: " << gindex;
|
||||
WLT_LOG_YELLOW(ss.str(), LOG_LEVEL_0);
|
||||
if (m_wcallback)
|
||||
m_wcallback->on_message(i_wallet2_callback::ms_yellow, ss.str());
|
||||
continue;
|
||||
}
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(!td.is_spent(), "transfer is spent, tid: " << tid << ", ref from input with amount: " << intk.amount << ", gindex: " << gindex);
|
||||
// own output is spent, handle it
|
||||
break;
|
||||
}
|
||||
}
|
||||
// tracking wallet, assuming all outputs are spent directly because of mix_attr = 1
|
||||
tid = get_directly_spent_transfer_id_by_input_in_tracking_wallet(intk);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1584,6 +1555,49 @@ bool wallet2::has_related_alias_entry_unconfirmed(const currency::transaction& t
|
|||
return false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
uint64_t wallet2::get_directly_spent_transfer_id_by_input_in_tracking_wallet(const currency::txin_to_key& intk)
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(is_auditable() && is_watch_only(), "this is not an auditable-watch-only (tracking) wallet");
|
||||
|
||||
uint64_t tid = UINT64_MAX;
|
||||
|
||||
// try to find a reference among own UTXOs
|
||||
std::vector<txout_v> abs_key_offsets = relative_output_offsets_to_absolute(intk.key_offsets); // potential speed-up: don't convert to abs offsets as we interested only in direct spends for auditable wallets. Now it's kind a bit paranoid.
|
||||
for (auto v : abs_key_offsets)
|
||||
{
|
||||
if (v.type() != typeid(uint64_t))
|
||||
continue;
|
||||
uint64_t gindex = boost::get<uint64_t>(v);
|
||||
auto it = m_amount_gindex_to_transfer_id.find(std::make_pair(intk.amount, gindex));
|
||||
if (it != m_amount_gindex_to_transfer_id.end())
|
||||
{
|
||||
tid = it->second;
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(tid < m_transfers.size(), "invalid tid: " << tid << ", ref from input with amount: " << intk.amount << ", gindex: " << gindex);
|
||||
auto& td = m_transfers[it->second];
|
||||
if (intk.key_offsets.size() != 1)
|
||||
{
|
||||
// own output was used in non-direct transaction
|
||||
// the core should not allow this to happen, the only way it may happen - mixing in own output that was sent without mix_attr == 1
|
||||
// log strange situation
|
||||
std::stringstream ss;
|
||||
ss << "own transfer tid=" << tid << " tx=" << td.tx_hash() << " mix_attr=" << td.mix_attr() << ", is referenced by a transaction with mixins, ref from input with amount: " << intk.amount << ", gindex: " << gindex;
|
||||
WLT_LOG_YELLOW(ss.str(), LOG_LEVEL_0);
|
||||
if (m_wcallback)
|
||||
m_wcallback->on_message(i_wallet2_callback::ms_yellow, ss.str());
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(td.mix_attr() != CURRENCY_TO_KEY_OUT_FORCED_NO_MIX, ss.str()); // if mix_attr == 1 this should never happen (mixing in an output with mix_attr = 1) as the core must reject such txs
|
||||
// our own output has mix_attr != 1 for some reason (a sender did not set correct mix_attr e.g.)
|
||||
// but mixin count > 1 so we can't say it is spent for sure
|
||||
tid = UINT64_MAX;
|
||||
continue;
|
||||
}
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(td.m_spent_height == 0, "transfer is spent in blockchain, tid: " << tid << ", ref from input with amount: " << intk.amount << ", gindex: " << gindex);
|
||||
// okay, own output is being spent, return it
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tid;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
||||
{
|
||||
//get transaction pool content
|
||||
|
|
@ -1663,12 +1677,29 @@ void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
|||
auto& in = tx.vin[i];
|
||||
if (in.type() == typeid(currency::txin_to_key))
|
||||
{
|
||||
auto it = m_key_images.find(boost::get<currency::txin_to_key>(in).k_image);
|
||||
if (it != m_key_images.end())
|
||||
const currency::txin_to_key& intk = boost::get<currency::txin_to_key>(in);
|
||||
uint64_t tid = UINT64_MAX;
|
||||
if (is_auditable() && is_watch_only())
|
||||
{
|
||||
tx_money_spent_in_ins += boost::get<currency::txin_to_key>(in).amount;
|
||||
// tracking wallet, assuming all outputs are spent directly because of mix_attr = 1
|
||||
tid = get_directly_spent_transfer_id_by_input_in_tracking_wallet(intk);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wallet with spend secret key -- we can calculate own key images and then search among them
|
||||
auto it = m_key_images.find(intk.k_image);
|
||||
if (it != m_key_images.end())
|
||||
{
|
||||
tid = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
if (tid != UINT64_MAX)
|
||||
{
|
||||
// own output is being spent by this input
|
||||
tx_money_spent_in_ins += intk.amount;
|
||||
td.spent_indices.push_back(i);
|
||||
spend_transfers.push_back(it->second);
|
||||
spend_transfers.push_back(tid);
|
||||
}
|
||||
}
|
||||
else if (in.type() == typeid(currency::txin_multisig))
|
||||
|
|
@ -4281,7 +4312,7 @@ bool wallet2::is_transfer_ready_to_go(const transfer_details& td, uint64_t fake_
|
|||
void wallet2::wipeout_extra_if_needed(std::vector<wallet_public::wallet_transfer_info>& transfer_history)
|
||||
{
|
||||
WLT_LOG_L0("Processing [wipeout_extra_if_needed]...");
|
||||
for (auto it = transfer_history.begin(); it != transfer_history.end(); )
|
||||
for (auto it = transfer_history.begin(); it != transfer_history.end(); it++ )
|
||||
{
|
||||
if (it->height > 638000)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -936,6 +936,7 @@ private:
|
|||
//void check_if_block_matched(uint64_t i, const crypto::hash& id, bool& block_found, bool& block_matched, bool& full_reset_needed);
|
||||
uint64_t detach_from_block_ids(uint64_t height);
|
||||
uint64_t get_wallet_minimum_height();
|
||||
uint64_t get_directly_spent_transfer_id_by_input_in_tracking_wallet(const currency::txin_to_key& intk);
|
||||
|
||||
void push_alias_info_to_extra_according_to_hf_status(const currency::extra_alias_entry& ai, std::vector<currency::extra_v>& extra);
|
||||
void remove_transfer_from_amount_gindex_map(uint64_t tid);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@
|
|||
return API_RETURN_CODE_WALLET_WRONG_ID; \
|
||||
auto& name = it->second.w;
|
||||
|
||||
#define GET_WALLET_OPTIONS_BY_ID_VOID_RET(wallet_id, name) \
|
||||
SHARED_CRITICAL_REGION_LOCAL(m_wallets_lock); \
|
||||
auto it = m_wallets.find(wallet_id); \
|
||||
if (it == m_wallets.end()) \
|
||||
return; \
|
||||
auto& name = it->second;
|
||||
|
||||
#ifdef MOBILE_WALLET_BUILD
|
||||
#define DAEMON_IDLE_UPDATE_TIME_MS 10000
|
||||
#define TX_POOL_SCAN_INTERVAL 5
|
||||
|
|
@ -1744,12 +1751,15 @@ void wallets_manager::on_new_block(size_t wallet_id, uint64_t /*height*/, const
|
|||
}
|
||||
|
||||
void wallets_manager::on_transfer2(size_t wallet_id, const tools::wallet_public::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined)
|
||||
{
|
||||
{
|
||||
view::transfer_event_info tei = AUTO_VAL_INIT(tei);
|
||||
tei.ti = wti;
|
||||
tei.balance = balance;
|
||||
tei.unlocked_balance = unlocked_balance;
|
||||
tei.wallet_id = wallet_id;
|
||||
|
||||
GET_WALLET_OPTIONS_BY_ID_VOID_RET(wallet_id, w);
|
||||
tei.is_wallet_in_sync_process = w.long_refresh_in_progress;
|
||||
m_pview->money_transfer(tei);
|
||||
}
|
||||
void wallets_manager::on_pos_block_found(size_t wallet_id, const currency::block& b)
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ if [ -n "$build_prefix" ]; then
|
|||
build_prefix_label="$build_prefix "
|
||||
fi
|
||||
|
||||
if [ -n "$testnet" ]; then
|
||||
if [ "$testnet" == true ]; then
|
||||
testnet_def="-D TESTNET=TRUE"
|
||||
testnet_label="testnet "
|
||||
ARCHIVE_NAME_PREFIX=${ARCHIVE_NAME_PREFIX}testnet-
|
||||
fi
|
||||
|
||||
if [ -n "$testnet" ] || [ -n "$qt_dev_tools" ]; then
|
||||
if [ "$testnet" == true ] || [ -n "$qt_dev_tools" ]; then
|
||||
copy_qt_dev_tools=true
|
||||
copy_qt_dev_tools_label="devtools "
|
||||
ARCHIVE_NAME_PREFIX=${ARCHIVE_NAME_PREFIX}devtools-
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ if [ -n "$build_prefix" ]; then
|
|||
build_prefix_label="$build_prefix "
|
||||
fi
|
||||
|
||||
if [ -n "$testnet" ]; then
|
||||
if [ "$testnet" == true ]; then
|
||||
testnet_def="-D TESTNET=TRUE"
|
||||
testnet_label="testnet "
|
||||
ARCHIVE_NAME_PREFIX=${ARCHIVE_NAME_PREFIX}testnet-
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ IF NOT [%build_prefix%] == [] (
|
|||
SET ACHIVE_NAME_PREFIX=%ACHIVE_NAME_PREFIX%%build_prefix%-
|
||||
)
|
||||
|
||||
IF NOT [%testnet%] == [] (
|
||||
IF "%testnet%" == "true" (
|
||||
SET TESTNET_DEF=-D TESTNET=TRUE
|
||||
SET TESTNET_LABEL=testnet
|
||||
SET ACHIVE_NAME_PREFIX=%ACHIVE_NAME_PREFIX%testnet-
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue