Problem: The commit mode behaves incorrectly.#2510
Conversation
Solution: Parse the Tendermint response properly. The functionality was disabled in https://github.com/bigchaindb/bigchaindb/pull/2235/files#diff-c6511560546a7dc577e7e647b5bfdaceL68 and was not fixed since then.
| deliver_tx_code = result['deliver_tx'].get('code', 0) | ||
| error_code = check_tx_code or deliver_tx_code | ||
| else: | ||
| error_code = result.get('code', 0) |
There was a problem hiding this comment.
Can we please have a test case for this response object
kansi
left a comment
There was a problem hiding this comment.
Looks good. Please check the CI
|
|
||
| result = response['result'] | ||
| if mode == self.mode_commit: | ||
| check_tx_code = result.get('check_tx', {}).get('code', 0) |
There was a problem hiding this comment.
If you omit the second parameter, get returns None if the lookup is unsuccessful, so you can just write check_tx_code = result.get('check_tx', {}).get('code') if you want.
There was a problem hiding this comment.
0 is the success code the API uses so I put it there but None would work here as well. I do not have a preference.
vrde
left a comment
There was a problem hiding this comment.
I don't have a clear understanding of what kind of response Tendermint, but if the acceptance test passes, I'm happy :)
I've added a small comment on your code that you can address if you want.
Codecov Report
@@ Coverage Diff @@
## master #2510 +/- ##
==========================================
+ Coverage 91.73% 92.02% +0.28%
==========================================
Files 41 42 +1
Lines 2467 2519 +52
==========================================
+ Hits 2263 2318 +55
+ Misses 204 201 -3 |
* Problem: The commit mode behaves incorrectly. Solution: Parse the Tendermint response properly. The functionality was disabled in https://github.com/bigchaindb/bigchaindb/pull/2235/files#diff-c6511560546a7dc577e7e647b5bfdaceL68 and was not fixed since then. * Add a test case for the sync mode. * Do not strictly expect deliver_tx in the response. * Fix post_mock in web/test_transactions.py. * Check for the error field first.
Solution: Parse the Tendermint response properly. The functionality was disabled in https://github.com/bigchaindb/bigchaindb/pull/2235/files#diff-c6511560546a7dc577e7e647b5bfdaceL68 and was not fixed since then.