From b7bc041f79ac254fd5baf768f2c29e39706de7d5 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 24 May 2016 11:25:54 -0300 Subject: [PATCH] add comment --- lib/server.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/server.js b/lib/server.js index 51361ac..f8636d1 100644 --- a/lib/server.js +++ b/lib/server.js @@ -942,9 +942,13 @@ WalletService.prototype._getUtxosForCurrentWallet = function(addresses, cb) { }); }, function(next) { - var fromTs = Math.floor(Date.now() / 1000) - 24 * 3600; + var now = Math.floor(Date.now() / 1000); + // Fetch latest broadcasted txs and remove any spent inputs from the + // list of UTXOs returned by the block explorer. This counteracts any out-of-sync + // effects between broadcasting a tx and getting the list of UTXOs. + // This is especially true in the case of having multiple instances of the block explorer. self.storage.fetchBroadcastedTxs(self.walletId, { - minTs: fromTs, + minTs: now - 24 * 3600, limit: 100 }, function(err, txs) { if (err) return next(err);