From bb364196e3c85ac4d8d71ebd40a7ced2a662a8f1 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Mon, 16 Oct 2017 18:12:30 +0300 Subject: [PATCH] native send not fully synced warning --- react/src/actions/actions/nativeSyncInfo.js | 2 +- .../src/components/dashboard/sendCoin/sendCoin.js | 14 +++++++++++++- .../dashboard/sendCoin/sendCoin.render.js | 5 +++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index d87e5a5..cff4fb9 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -15,7 +15,7 @@ export function nativeGetinfoFailureState() { } } -// TODO: use debug.log instead +// TODO: use blockchaininfo rpc export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) { let _json = json; diff --git a/react/src/components/dashboard/sendCoin/sendCoin.js b/react/src/components/dashboard/sendCoin/sendCoin.js index 5cd3311..54199af 100644 --- a/react/src/components/dashboard/sendCoin/sendCoin.js +++ b/react/src/components/dashboard/sendCoin/sendCoin.js @@ -22,7 +22,6 @@ import { isPositiveNumber } from '../../../util/number'; // TODO: - add links to explorers // - render z address trim -// spv, request utxo and check if any failed to verify, display alert notice class SendCoin extends React.Component { constructor(props) { @@ -53,6 +52,7 @@ class SendCoin extends React.Component { this.SendFormRender = _SendFormRender.bind(this); this.isTransparentTx = this.isTransparentTx.bind(this); this.toggleSubstractFee = this.toggleSubstractFee.bind(this); + this.isFullySynced = this.isFullySynced.bind(this); } SendFormRender() { @@ -554,6 +554,17 @@ class SendCoin extends React.Component { return false; } + isFullySynced() { + if (this.props.ActiveCoin.progress && + this.props.ActiveCoin.progress.longestchain && + this.props.ActiveCoin.progress.blocks && + this.props.ActiveCoin.progress.longestchain > 0 && + this.props.ActiveCoin.progress.blocks > 0 && + Number(this.state.prevProgress.blocks) * 100 / Number(this.state.prevProgress.longestchain) === 100) { + return true; + } + } + render() { if (this.props && this.props.ActiveCoin && @@ -575,6 +586,7 @@ const mapStateToProps = (state, props) => { balance: state.ActiveCoin.balance, activeSection: state.ActiveCoin.activeSection, lastSendToResponse: state.ActiveCoin.lastSendToResponse, + progress: state.ActiveCoin.progress, }, Dashboard: state.Dashboard, }; diff --git a/react/src/components/dashboard/sendCoin/sendCoin.render.js b/react/src/components/dashboard/sendCoin/sendCoin.render.js index 50f2120..6c89d86 100644 --- a/react/src/components/dashboard/sendCoin/sendCoin.render.js +++ b/react/src/components/dashboard/sendCoin/sendCoin.render.js @@ -121,6 +121,11 @@ export const _SendFormRender = function() { { this.props.ActiveCoin.coin } + { !this.isFullySynced() && this.props.ActiveCoin && this.props.ActiveCoin.mode === 'native' && +
+ Your wallet is not fully synced! Please wait until it reached 100% to avoid possible transaction send implications. +
+ }