feat(json_rpc): implement new get_data_request - #2631
Conversation
| Committing, | ||
| /// A data request transaction that got included in a block and is currently in REVEAL phase. | ||
| Revealing, | ||
| /// A data request transaction that got solved. |
There was a problem hiding this comment.
Are we missing the Tallying stage here?
There was a problem hiding this comment.
Not relevant for the method caller. Moreover, isn't the tally transaction expected to be included within the same block as the (last) reveal transactions?
There was a problem hiding this comment.
Not relevant for the method caller. Moreover, isn't the tally transaction expected to be included at the same time as the (last) reveal transactions?
Not the case yet. Tallying still takes place in the next block after the one that includes the last reveal transaction(s).
| query: get_dr_query_params(hash).await.ok(), | ||
| result: if let Some(confirmations) = confirmations { | ||
| Some(DataRequestQueryResult { | ||
| cbor_bytes: hex::encode(report.tally.unwrap_or_default().tally), | ||
| confirmations, | ||
| timestamp: timestamp.unwrap_or_default(), | ||
| }) | ||
| } else { | ||
| None | ||
| }, |
There was a problem hiding this comment.
Let's try to have query and result as variables above so the return structure is free from business logic.
| result: if let Some(confirmations) = confirmations { | ||
| Some(DataRequestQueryResult { | ||
| cbor_bytes: hex::encode(report.tally.unwrap_or_default().tally), | ||
| confirmations, | ||
| timestamp: timestamp.unwrap_or_default(), | ||
| }) | ||
| } else { | ||
| None | ||
| }, |
There was a problem hiding this comment.
This block looks like an Option<_>::map:
let result = confirmations.map(|confirmations| DataRequestQueryResult {
cbor_bytes: hex::encode(report.tally.unwrap_or_default().tally),
confirmations,
timestamp: timestamp.unwrap_or_default(),
})3a03bd1 to
b207ed9
Compare
| force: bool, | ||
| } | ||
|
|
||
| /// Enumerates all the states in which a data reuqest transaction can be. |
There was a problem hiding this comment.
| /// Enumerates all the states in which a data reuqest transaction can be. | |
| /// Enumerates all the states in which a data request transaction can be. |
|
LGTM, can we merge it in 2.1 branch and release from there? |
Close #2628