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

Function sends_a_transaction

chain/src/blockchain.rs:369–384  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

367
368 #[tokio::test]
369 async fn sends_a_transaction() {
370 let (blockchain, _, _) = setup().await;
371 let to = Account::random();
372 let transaction = new_transaction(to, blockchain.clone()).await;
373 let transaction_hash = blockchain
374 .lock()
375 .await
376 .send_transaction(transaction.into())
377 .await
378 .unwrap();
379
380 assert_receipt(blockchain.clone(), transaction_hash).await;
381
382 let balance = get_balance(blockchain, &to).await;
383 assert_eq!(balance, U256::from(10));
384 }
385
386 #[tokio::test]
387 async fn send_a_raw_transaction() {

Callers

nothing calls this directly

Calls 5

setupFunction · 0.85
assert_receiptFunction · 0.85
get_balanceFunction · 0.85
new_transactionFunction · 0.70
send_transactionMethod · 0.45

Tested by

no test coverage detected