Skip to content

Commit 9c80ce0

Browse files
committed
feat(Chain): Add option allowUnsynced for poll method which allow to depend on get tx/info API
1 parent f0779ff commit 9c80ce0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

es/chain/node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ async function topBlock () {
139139
return top[R.head(R.keys(top))]
140140
}
141141

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

146146
async function probe () {
147147
const tx = await instance.tx(th).catch(_ => null)
148-
if (tx && tx.blockHeight !== -1) {
148+
if (tx && (tx.blockHeight !== -1 || (allowUnsynced && tx.height))) {
149149
return tx
150150
}
151151
if (await instance.height() < max) {

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)