Last active
January 5, 2018 23:12
-
-
Save plenarius/689947a4126b88765cc9f9d4e1f2146b to your computer and use it in GitHub Desktop.
iota isConfirmed on tail hash
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
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