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
get_transaction will now return a tx from backlog, even if there are some in invalid blocks #793
Conversation
Note: I originally didn't add the second test and code coverage went down slightly. Once I added the second test, code coverage went up by 0.06%. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
input_tx = b.get_transaction(input_tx.txid) | ||
inputs = input_tx.to_inputs() | ||
tx = Transaction.transfer(inputs, [user_vk], input_tx.asset) | ||
tx = tx.sign([user_sk]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note, not a blocker to merge this PR.
I wonder whether it is really needed to write a "real" tx for this test, as it seems all we would need is a "dummy" tx, just to make sure the block in-validation can take place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I'm not sure how to go about that. I based the two "new" tests on the one original test, so at least this is no worse than before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah, ok, no problem!
👍 |
I made a slight change to how
Bigchain.get_transaction()
works.Before, if there was a transaction with the specified
txid
in the backlog and in some invalid blocks (but nowhere else),Bigchain.get_transaction()
would returnNone
. I changed it so that in that case, it returns the transaction from the backlog (and if the user asked for the transaction's status, it will be'backlog'
).I updated and expanded the docstring for
Bigchain.get_transaction()
.I also changed the test which checked to see the response to
Bigchain.get_transaction()
when there's a copy of the transaction in an invalid block. Before, it didn't care about the backog: the response was always expected to beNone
. Now it does care about the backlog, so the original test was split into two tests: