Skip to content

Instantly share code, notes, and snippets.

@brkphp
Last active January 26, 2018 12:53
Show Gist options
  • Save brkphp/509ea713fd89ec990ebdef566d19e2cb to your computer and use it in GitHub Desktop.
Save brkphp/509ea713fd89ec990ebdef566d19e2cb to your computer and use it in GitHub Desktop.
iota rebroadcast
'use strict';
var IOTA;
const IOTA = require('iota.lib.js');
var tx = "yourtx"
const iota = new IOTA({
'host': 'http://iri4.iota.fm',
'port': 80
});
function rebroadcast(iotajs,tx){
console.log('rebroadcasting ' + tx + ' ..');
iotajs.api.broadcastBundle(tx,function(err, success) {
if (!err) {
console.log('Successfully rebroadcast: ' + tx);
}else {
console.log(err);
if (err != 'Error: Invalid tail transaction supplied.' || err != 'Error: Invalid Bundle provided') {
rebroadcast(iotajs, tx);
}
}
});
}
rebroadcast(iota, tx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment