Last active
December 13, 2017 23:24
-
-
Save cyclux/0f3b6ed56e34dd3e5609e4b57ab7c47e to your computer and use it in GitHub Desktop.
IOTA reattacher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var IOTA; | |
IOTA = require('./iota.lib.js/lib/iota'); | |
var tailTX = process.argv[2]; | |
var iotajs = new IOTA({ | |
'host': http://localhost, | |
'port': 14265 | |
}); | |
console.log('Reattaching ' + tailTX + ' ..'); | |
function reattach(iotajs, tailTX){ | |
iotajs.api.replayBundle(tailTX, 3, 14, function(e, r) { | |
if (!e) { | |
console.log('Successfully re-attached: ' + tailTX); | |
} | |
else { | |
console.log('Failed to reattach...'); | |
console.log(e); | |
if (e != 'Error: Invalid tail transaction supplied.' || e != 'Error: Invalid Bundle provided') { | |
console.log('Retry...'); | |
reattach(iotajs, tailTX); | |
} | |
} | |
}); | |
} | |
reattach(iotajs, tailTX); |
The reatacher works. But, how do you manage to use the reatacher to get a tx confirmed?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run it just use:
node reattacher.js TAIL9TRANSACTION9HASH99999