Skip to content

Commit

Permalink
Merge pull request #241 from Bitcoin-com/wallet/dev
Browse files Browse the repository at this point in the history
Wallet/dev
  • Loading branch information
Jean-Baptiste Dominguez committed Aug 3, 2018
2 parents 61343af + 9e5bd66 commit 114cb5e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
6 changes: 3 additions & 3 deletions app-template/bitcoincom/appConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c",
"pushSenderId": "1036948132229",
"description": "A Secure Bitcoin Wallet",
"version": "4.13.1",
"fullVersion": "4.13-rc2",
"androidVersion": "413100",
"version": "4.13.2",
"fullVersion": "4.13-rc3",
"androidVersion": "413200",
"_extraCSS": "",
"_enabledExtensions": {
"coinbase": false,
Expand Down
37 changes: 26 additions & 11 deletions src/js/services/walletService.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,19 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
if (err) return cb(err);

if (!txsFromServer.length)
return cb();

var res = lodash.takeWhile(txsFromServer, function(tx) {
return tx.txid != endingTxid;
});
return cb(null, []);

return cb(null, res, res.length >= limit);
return cb(null, txsFromServer);
});
};

var removeAndMarkSoftConfirmedTx = function(txs) {
return lodash.filter(txs, function(tx) {
if (tx.confirmations >= root.SOFT_CONFIRMATION_LIMIT)
return tx;
tx.recent = true;
var isConfirm = (tx.confirmations >= root.SOFT_CONFIRMATION_LIMIT);
if (!isConfirm) {
tx.recent = true;
}
return isConfirm;
});
}

Expand Down Expand Up @@ -437,12 +435,14 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
var endingTxid = confirmedTxs[0] ? confirmedTxs[0].txid : null;
var endingTs = confirmedTxs[0] ? confirmedTxs[0].time : null;

$log.debug('Confirmed TXs. Got:' + confirmedTxs.length + '/' + txsFromLocal.length);

// First update
progressFn(txsFromLocal, 0);
wallet.completeHistory = txsFromLocal;

function getNewTxs(newTxs, skip, next) {
getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
getTxsFromServer(wallet, skip, endingTxid, requestLimit, function(err, res) {
if (err) {
$log.warn(bwcError.msg(err, 'Server Error')); //TODO
if (err instanceof errors.CONNECTION_ERROR || (err.message && err.message.match(/5../))) {
Expand All @@ -454,7 +454,22 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
return next(err);
}

newTxs = newTxs.concat(processNewTxs(wallet, lodash.compact(res)));
// Check if new txs are founds, if yes, lets investigate in the 50 next
// To be sure we are not missing txs by sorting (maybe a new tx is after the "endingTxid"
var newDiscoveredTxs = res.filter(function (x) {
return confirmedTxs.filter(function (confX) {
return confX.txid == x.txid;
}).length == 0;
});

$log.debug('Discovering TXs. Got:' + newDiscoveredTxs.length);

var shouldContinue = newDiscoveredTxs.length > 0;

// If no new tx, no need to check
if (shouldContinue) {
newTxs = newTxs.concat(processNewTxs(wallet, lodash.compact(newDiscoveredTxs)));
}

progressFn(newTxs.concat(txsFromLocal), newTxs.length);

Expand Down
1 change: 1 addition & 0 deletions src/sass/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
.button {
border-radius: 6px;
&.button-full {
border-radius: 0;
display: block;
}
&-green {
Expand Down
1 change: 1 addition & 0 deletions src/sass/views/includes/clickToAccept.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ click-to-accept {
.click-to-accept {

&__button.button.button-primary.button-standard {
border-radius: 0;
height: 100%;
max-width: 9999px;
width: 100%;
Expand Down
3 changes: 3 additions & 0 deletions src/sass/views/includes/slideToAccept.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ slide-to-accept {
}

.slide {
.button {
border-radius: 0;
}
&__listener {
height: 100%;
width: 100%;
Expand Down

0 comments on commit 114cb5e

Please sign in to comment.