Skip to content

Commit

Permalink
feat(Chain): Add option allowUnsynced for poll method which allow…
Browse files Browse the repository at this point in the history
… to depend on `get tx/info` API
  • Loading branch information
nduchak committed Mar 30, 2020
1 parent f0779ff commit 9c80ce0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions es/chain/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ async function topBlock () {
return top[R.head(R.keys(top))]
}

async function poll (th, { blocks = 10, interval = 5000 } = {}) {
async function poll (th, { blocks = 10, interval = 5000, allowUnsynced = false } = {}) {
const instance = this
const max = await this.height() + blocks

async function probe () {
const tx = await instance.tx(th).catch(_ => null)
if (tx && tx.blockHeight !== -1) {
if (tx && (tx.blockHeight !== -1 || (allowUnsynced && tx.height))) {
return tx
}
if (await instance.height() < max) {
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9c80ce0

Please sign in to comment.