hyperledger-labs / go-perun

🌔 Perun's Blockchain-Agnostic State Channels Framework in Go.
https://perun.network/
Apache License 2.0
55 stars 18 forks source link

ContractBackend.confirmNTimes fails with "pulling receipt" #308

Closed matthiasgeihs closed 2 years ago

matthiasgeihs commented 2 years ago

Location

https://github.com/hyperledger-labs/go-perun/blob/f3f8a24b496695824e821568825758cfd4131bab/backend/ethereum/channel/contractbackend.go#L203

Problem

confirmNTimes pulls the transaction receipt at least two times. Once for confirming that the transaction has been included in the chain, and then each time a new block is mined (until the transaction is confirmed sufficiently often). We observed in the context of the web app (Goerli Network) that it can happen that the tx is first found, and then not found anymore. In this case, confirmNTimes fails with "pulling receipt".

Proposal

Instead of failing, the logic should instead continue to wait for the transaction to be confirmed. In fact, such an error could have happened due to a reorg, which means that we probably would want to reset the transaction confirmation counter in such a case. (I am currently unsure if we do this already.)