mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
confirmations counted, transitions to final step
This commit is contained in:
parent
41b688dda1
commit
97b41dc065
2 changed files with 6 additions and 9 deletions
|
@ -123,7 +123,6 @@
|
||||||
txListener.confirmations = res.confirmations;
|
txListener.confirmations = res.confirmations;
|
||||||
|
|
||||||
txListener.initSocket(function() {
|
txListener.initSocket(function() {
|
||||||
console.log("callback called, step 4");
|
|
||||||
$('#walletCommandsSubmit').removeClass('hidden');
|
$('#walletCommandsSubmit').removeClass('hidden');
|
||||||
document.getElementById('step_four').click();
|
document.getElementById('step_four').click();
|
||||||
document.getElementsByClassName('progress-bar')[0].style.width = "100%";
|
document.getElementsByClassName('progress-bar')[0].style.width = "100%";
|
||||||
|
|
|
@ -12,6 +12,7 @@ function TXListener(socket, provider, transaction) {
|
||||||
TXListener.prototype.initSocket = function(cb) {
|
TXListener.prototype.initSocket = function(cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var socket = this.socket;
|
var socket = this.socket;
|
||||||
|
var confirmations = 0;
|
||||||
|
|
||||||
socket.on('block', function(data) {
|
socket.on('block', function(data) {
|
||||||
console.log('block: '+ data);
|
console.log('block: '+ data);
|
||||||
|
@ -19,18 +20,15 @@ TXListener.prototype.initSocket = function(cb) {
|
||||||
self.getBlock(data, function(err, res) {
|
self.getBlock(data, function(err, res) {
|
||||||
|
|
||||||
if (err) console.log("error fetching block: " + data);
|
if (err) console.log("error fetching block: " + data);
|
||||||
self.confirmations = (res.height - self.blockheight) + 1; // compare blockHeight against transaction blockHeight
|
//self.confirmations = (res.height - self.blockheight) + 1; // compare blockHeight against transaction blockHeight
|
||||||
var confirmation_count = (res.height - self.confirmations) + 1;
|
confirmations++;
|
||||||
console.log("res: ", res);
|
|
||||||
console.log("self: ", self);
|
|
||||||
console.log(confirmation_count);
|
|
||||||
|
|
||||||
if (confirmation_count >= 6) {
|
if (confirmations >= 6) {
|
||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
$("#progressbar").progressbar({value: ((100 / 6) * self.confirmations)});
|
$("#progressbar").progressbar({value: ((100 / 6) * confirmations)});
|
||||||
|
|
||||||
console.log('confirmations: ' + self.confirmations);
|
console.log('confirmations: ' + confirmations);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue