Inspect a proposal and decide whether to vote on it.
(
&self,
request: request::ProcessProposal,
)
| 888 | |
| 889 | /// Inspect a proposal and decide whether to vote on it. |
| 890 | async fn process_proposal( |
| 891 | &self, |
| 892 | request: request::ProcessProposal, |
| 893 | ) -> AbciResult<response::ProcessProposal> { |
| 894 | tracing::debug!( |
| 895 | height = request.height.value(), |
| 896 | time = request.time.to_string(), |
| 897 | "process proposal" |
| 898 | ); |
| 899 | let txs: Vec<_> = request.txs.into_iter().map(|tx| tx.to_vec()).collect(); |
| 900 | let num_txs = txs.len(); |
| 901 | |
| 902 | let accept = self |
| 903 | .interpreter |
| 904 | .process(self.chain_env.clone(), txs) |
| 905 | .await |
| 906 | .context("failed to process proposal")?; |
| 907 | |
| 908 | emit!(ProposalProcessed { |
| 909 | is_accepted: accept, |
| 910 | block_height: request.height.value(), |
| 911 | block_hash: request.hash.to_string().as_str(), |
| 912 | num_txs, |
| 913 | proposer: request.proposer_address.to_string().as_str() |
| 914 | }); |
| 915 | |
| 916 | if accept { |
| 917 | Ok(response::ProcessProposal::Accept) |
| 918 | } else { |
| 919 | Ok(response::ProcessProposal::Reject) |
| 920 | } |
| 921 | } |
| 922 | /// The transaction execution step of the application. Combines what used to be `BeginBlock`, `DeliverTx`, and `EndBlock`. |
| 923 | async fn finalize_block( |
| 924 | &self, |