goat-systems / go-tezos

Go Tezos Is a Go library that exposes and builds upon the Tezos RPC.
MIT License
71 stars 43 forks source link

WaitForOperations Discussion #38

Closed utdrmac closed 5 years ago

utdrmac commented 5 years ago

In the app I'm writing, you create payments, sign them with the wallet, and then call goTezos.PostResponse to /injection/operation This usually returns immediately, indicating that your op was accepted by the node to which you are connected. But the return does not mean it has been processed by the network. You have to wait, at minimum, for the current block to complete, or in the future when there are many more transactions per block, you may need to wait several blocks.

The tezos-client provides wait for <op> to be included, which does the following:

35 supports fetching block operation hashs. After/When/If merged, what is the best way to "poll" looking for ops using goTezos?

Here is a function that I was considering adding to goTezosBlock.go: https://gist.github.com/utdrmac/74e00b6c722dcbd3dffd9e7961a00b33

Thoughts on this? Should this be added to goTezos or should this type of implementation be left up to the caller and just utilize #35?