MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / send_raw_transaction

Method send_raw_transaction

chain/src/blockchain.rs:106–116  ·  view source on GitHub ↗
(&mut self, transaction: Bytes)

Source from the content-addressed store, hash-verified

104 }
105
106 pub(crate) async fn send_raw_transaction(&mut self, transaction: Bytes) -> Result<H256> {
107 let signed_transaction: SignedTransaction = bincode::deserialize(&transaction)?;
108 let transaction: Transaction = signed_transaction.clone().try_into()?;
109 let transaction_hash = transaction.transaction_hash()?;
110
111 Transaction::verify(signed_transaction, transaction.from).map_err(|e| {
112 ChainError::TransactionNotVerified(format!("{}: {}", transaction_hash, e))
113 })?;
114
115 self.send_transaction(transaction.into()).await
116 }
117
118 pub(crate) async fn process_transactions(&mut self) -> Result<()> {
119 // Bulk drain the current queue to fit into the new block

Callers 2

send_a_raw_transactionFunction · 0.80
eth_send_raw_transactionFunction · 0.80

Calls 5

deserializeFunction · 0.85
verifyFunction · 0.85
transaction_hashMethod · 0.80
try_intoMethod · 0.45
send_transactionMethod · 0.45

Tested by

no test coverage detected