Skip to content

Commit

Permalink
fix(rpc-test): await for RPC confirmation that the tx is included
Browse files Browse the repository at this point in the history
  • Loading branch information
voliva committed Sep 10, 2024
1 parent 9c6189d commit ca1edda
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/e2e/src/rpc-spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ describe('transaction_v1', async () => {
const tx = await api.tx.balances.transferKeepAlive(bob.address, TRANSFERRED_VALUE).signAsync(alice)
const { nextValue, subscription } = observe(chainHead.trackTx$(tx.toHex()))
const resultPromise = nextValue()
const broadcast = testApi.observableClient.broadcastTx$(tx.toHex()).subscribe()
await new Promise((onSuccess, onError) =>
testApi.substrateClient._request('transaction_v1_broadcast', [tx.toHex()], { onSuccess, onError }),
)

// We don't have a confirmation of when the transaction has been broadcasted through the network
// it just continues to get broadcasted through the nodes until we unsubscribe from it.
Expand All @@ -45,7 +47,6 @@ describe('transaction_v1', async () => {
},
})

broadcast.unsubscribe()
subscription.unsubscribe()
chainHead.unfollow()
})
Expand Down

0 comments on commit ca1edda

Please sign in to comment.