Skip to content

add: Await InBlock and Broadcast Status When Sending Extrinsic #69

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

Closed
wants to merge 2 commits into from

Conversation

developerfred
Copy link

@developerfred developerfred commented Apr 30, 2020

#65

update jenkins

#74

@brenzi
Copy link
Contributor

brenzi commented May 1, 2020

@developerfred thanks for your PR. May I ask you to fix the unit test?

@developerfred
Copy link
Author

@brenzi I will fix

@brenzi
Copy link
Contributor

brenzi commented May 1, 2020

It could be that the error actually comes from testing against the wrong node in jenkins. The api-client should now actually test against our node-template #71

@developerfred
Copy link
Author

@brenzi I'll take a look at the issue #71

@brenzi
Copy link
Contributor

brenzi commented May 2, 2020

@developerfred I'v manually tested your PR. It builds, but it doesn't work. Here's how to reproduce:

https://github.com/scs/substrate-node-template.git
git checkout test-api-client
cargo build --release
./target/release/node-template purge-chain --dev
./target/release/node-template --dev

# other terminal
https://github.com/developerfred/substrate-api-client.git
git checkout await-InBlock 
cargo build --release --examples
RUST_LOG=debug ./target/release/examples/example_transfer

The log should show you that the client waits for finalized

now, change the example:

diff --git a/src/examples/example_transfer.rs b/src/examples/example_transfer.rs
index 094cbf6..4ae73e5 100755
--- a/src/examples/example_transfer.rs
+++ b/src/examples/example_transfer.rs
@@ -47,7 +47,7 @@ fn main() {
 
     // send and watch extrinsic until finalized
     let tx_hash = api
-        .send_extrinsic(xt.hex_encode(), XtStatus::Finalized)
+        .send_extrinsic(xt.hex_encode(), XtStatus::InBlock)
         .unwrap();
     println!("[+] Transaction got finalized. Hash: {:?}\n", tx_hash);

I would expect it to wait for InBlock now, but it only awaits Ready.
That's because you're calling the exact same function that we wrote to wait for ready. I'll comment in your commit

@developerfred
Copy link
Author

@brenzi fixed pull on 9344146

@developerfred developerfred requested a review from brenzi May 2, 2020 14:34
Copy link
Contributor

@brenzi brenzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please stop working on this

@developerfred developerfred requested a review from brenzi May 2, 2020 15:08
@brenzi
Copy link
Contributor

brenzi commented May 4, 2020

I'm sorry that I have to disappoint you @developerfred but we do prefer to wait for a task until it is well done and reviewing it when it is tested and ready

@brenzi brenzi closed this May 4, 2020
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