Skip to content

Instantly share code, notes, and snippets.

@cyclux
Last active December 13, 2017 23:24
Show Gist options
  • Save cyclux/0f3b6ed56e34dd3e5609e4b57ab7c47e to your computer and use it in GitHub Desktop.
Save cyclux/0f3b6ed56e34dd3e5609e4b57ab7c47e to your computer and use it in GitHub Desktop.
IOTA reattacher
'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);
@cyclux
Copy link
Author

cyclux commented Dec 7, 2017

To run it just use:
node reattacher.js TAIL9TRANSACTION9HASH99999

@agus-xyz
Copy link

agus-xyz commented Dec 13, 2017

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