-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix transaction logs incorrectly marked successful #1027
Fix transaction logs incorrectly marked successful #1027
Conversation
full-service/src/json_rpc/v2/e2e_tests/transaction/build_submit/build_then_submit.rs
Show resolved
Hide resolved
full-service/src/json_rpc/v2/e2e_tests/transaction/build_submit/build_then_submit.rs
Show resolved
Hide resolved
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.
Looks good!
I think failing a tranasction_log where the input is spent and the output is not present in the same block would be good for the case where 2x full-service with the same account keys are running together, which is a situation that inspired this PR.
That said, this PR fixes a bug whereas that would be an improvement, allowing the full-service with the failed tx to recognize it sooner, so could be the subject of a future PR.
Previously `transaction_log`s were marked successful if the input TXO(s) were spent according to the block chain. This was problematic when multiple `transaction_log`s were created that utilized the same input TXOs. These `transaction_log`s using the same input TXOs could happen when two clients were talking to the same Full-Service instance and those clients were using two step build and submit: 1. Client_a sends `build_transaction`, input TXO_n is used 2. Client_b sends `build_transaction`, input TXO_n is also used 3. Client_a `submit_transaction` 4. Client_b `submit_transaction` before the block chain knows that the Client_a transaction exists and will consume `TXO_n`. The blockchain will still reject this transaction eventually. 5. Previously, Full-Service would see that input TXO_n has been consumed and will mark **all** submitted `transaction_log`s that used TXO_n as successful. Now `transaction_log`s are marked successful based on if their output TXO(s) land on the blockchain. This ensures that only the transaction log that the blockchain accepted will be marked as successful.
ebd3a46
to
e4b40bf
Compare
Previously
transaction_log
s were marked successful if the input TXO(s)were spent according to the block chain. This was problematic when
multiple
transaction_log
s were created that utilized the same inputTXOs. These
transaction_log
s using the same input TXOs could happenwhen two clients were talking to the same Full-Service instance and
those clients were using two step build and submit:
build_transaction
, input TXO_n is usedbuild_transaction
, input TXO_n is also usedsubmit_transaction
submit_transaction
before the block chain knows that theClient_a transaction exists and will consume
TXO_n
. The blockchainwill still reject this transaction eventually.
and will mark all submitted
transaction_log
s that used TXO_n assuccessful.
Now
transaction_log
s are marked successful based on if their outputTXO(s) land on the blockchain. This ensures that only the transaction
log that the blockchain accepted will be marked as successful.