boltlabs-inc / zeekoe

Zero-knowledge layer-2 payment channels
MIT License
24 stars 1 forks source link

fix get contract_state() #278

Closed DariusParvin closed 3 years ago

DariusParvin commented 3 years ago

Fixes how get_contract() uses min_confirmations. To be clear, 0 confirmations would be considered not being in the blockchain, 1 confirmation is considered as being in the head.

Surprisingly, this hadn't been causing an issue on sandbox. I think the reason is because blocks are produced much faster on sandbox, so by the time the merchant was checking the blockchain, one block had probably elapsed. Without this fix, I got the following error when min_confirmations was 1 or 2. After this fix it worked for both values.

Error: Merchant chose to abort the session

Caused by:
    Could not verify contract's origination on chain
DariusParvin commented 3 years ago

I added a second commit to restrict confirmation_depth to greater than 0, since we shouldn't ever use 0.

DariusParvin commented 3 years ago

thanks! rebased and ran cargo fmt