Add support for transaction_v1_broadcast
#1724
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for the new JSON-RPC API functions.
This is implemented by adding a new
detached
boolean when adding a transaction to the transactions service, that indicates whether the transaction stays alive if all of its events receivers are dropped.When it comes to the JSON-RPC service, we mostly use the same code paths as
transactionWatch
.If a transaction of
transaction_v1_broadcast
is dropped for reasons such as a warp sync or a crash in the service, we immediately re-submit it to the transactions service. This forces the JSON-RPC service to maintain a separate copy of the transaction's bytes, which might seem like a hack, but given that the transactions service can crash there's no way around that anyway.If a transaction of
transaction_v1_broadcast
is dropped for other reasons, such as being invalid, we don't re-submit it.Note that I haven't tested the new code at all, as I can't really write tests that submit a transaction (don't want tests to cost money to run!). Since the code is mostly the existing code with some adjustments, chances are high that it's working.
Work time: 1h