Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awaiting broadcast of async transactions fails #937

Closed
wants to merge 1 commit into from

Conversation

Cashmaney
Copy link

When trying to send an async transaction via Tendermint34Client it will return an error when waiting for broadcastTxAsync to return.

Can be triggered by calling

const result = await tmClient.broadcastTxAsync({tx: txBytes});

Which results in:

e: TypeError: Cannot read property 'decodeBroadcastTxSync' of undefined
(node:38652) UnhandledPromiseRejectionWarning: ReferenceError: result is not defined
    at run (C:\Users\Itzik\WebstormProjects\signingtest\main_sg.js:62:28)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:38652) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1
)
(node:38652) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Even though the broadcast itself is successful. This small PR fixes this issue

Tested with Secret Network Testnet running Tendermint version v0.34.14

@webmaster128
Copy link
Member

Nice find! This affects pretty much all versions of CosmJS and can easily be reproduced in tests. It seels like this function was never used and never tested. Shame on us. It also shows that you should not use classes for namespacing in JavaScript. We don't write Java.

I'll write a patch that for 0.26.x and add the missing tests.

@webmaster128
Copy link
Member

Fix released as part of 0.26.5

@Cashmaney Cashmaney deleted the fix-async-broadcast branch November 20, 2021 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants