confirmations counted, transitions to final step

This commit is contained in:
hunterlester 2016-12-11 22:19:05 -08:00
parent 41b688dda1
commit 97b41dc065
2 changed files with 6 additions and 9 deletions

View file

@ -123,7 +123,6 @@
txListener.confirmations = res.confirmations;
txListener.initSocket(function() {
console.log("callback called, step 4");
$('#walletCommandsSubmit').removeClass('hidden');
document.getElementById('step_four').click();
document.getElementsByClassName('progress-bar')[0].style.width = "100%";

View file

@ -12,6 +12,7 @@ function TXListener(socket, provider, transaction) {
TXListener.prototype.initSocket = function(cb) {
var self = this;
var socket = this.socket;
var confirmations = 0;
socket.on('block', function(data) {
console.log('block: '+ data);
@ -19,18 +20,15 @@ TXListener.prototype.initSocket = function(cb) {
self.getBlock(data, function(err, res) {
if (err) console.log("error fetching block: " + data);
self.confirmations = (res.height - self.blockheight) + 1; // compare blockHeight against transaction blockHeight
var confirmation_count = (res.height - self.confirmations) + 1;
console.log("res: ", res);
console.log("self: ", self);
console.log(confirmation_count);
//self.confirmations = (res.height - self.blockheight) + 1; // compare blockHeight against transaction blockHeight
confirmations++;
if (confirmation_count >= 6) {
if (confirmations >= 6) {
cb();
};
$("#progressbar").progressbar({value: ((100 / 6) * self.confirmations)});
$("#progressbar").progressbar({value: ((100 / 6) * confirmations)});
console.log('confirmations: ' + self.confirmations);
console.log('confirmations: ' + confirmations);
});
});