Skip to content

Instantly share code, notes, and snippets.

@plenarius
Last active January 5, 2018 23:12
Show Gist options
  • Save plenarius/689947a4126b88765cc9f9d4e1f2146b to your computer and use it in GitHub Desktop.
Save plenarius/689947a4126b88765cc9f9d4e1f2146b to your computer and use it in GitHub Desktop.
iota isConfirmed on tail hash
function isConfirmed(tailtx) {
iota.api.getBundle(tailtx, (err, bundle) => {
if (err) { return -1; }
const inputs = bundle
.filter(input => input.value < 0)
.map(input => input.address);
iota.api.isReattachable(inputs, (err, reattachable) => {
if (err) { return -1; }
if (typeof(reattachable) === 'object' && reattachable.some(x => !x)) {
reattachable = false;
}
if(!reattachable) { return 1; }
return 0;
});
});
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment