poll address summary until balance non-zero or timeout
This commit is contained in:
parent
70d423f596
commit
9a921ad181
2 changed files with 17 additions and 2 deletions
test/integration
|
@ -19,10 +19,24 @@ function pollUnspent(blockchain, address, done) {
|
|||
|
||||
done(null, unspents)
|
||||
})
|
||||
}
|
||||
|
||||
function pollSummary(blockchain, address, done) {
|
||||
blockchain.addresses.summary(address, function (err, result) {
|
||||
if (err) return done(err)
|
||||
|
||||
if(result.balance == 0) {
|
||||
return setTimeout(function() {
|
||||
pollSummary(blockchain, address, done)
|
||||
}, 200)
|
||||
}
|
||||
|
||||
done(null, result)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
faucetWithdraw: faucetWithdraw,
|
||||
pollUnspent: pollUnspent
|
||||
pollUnspent: pollUnspent,
|
||||
pollSummary: pollSummary
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue