[receipt]: add sender & receiver to RichReceipts (#11179)
* [receipts]: add `to` & `from` to `RichReceipts` * [rpc]: add test for `pending_receipt` * docs(common_types/receipt): add note Option field
This commit is contained in:
@@ -1236,6 +1236,11 @@ impl miner::MinerService for Miner {
|
||||
let prev_gas = if index == 0 { Default::default() } else { receipts[index - 1].gas_used };
|
||||
let receipt = &receipts[index];
|
||||
RichReceipt {
|
||||
from: tx.sender(),
|
||||
to: match tx.action {
|
||||
Action::Create => None,
|
||||
Action::Call(ref address) => Some(*address),
|
||||
},
|
||||
transaction_hash: tx.hash(),
|
||||
transaction_index: index,
|
||||
cumulative_gas_used: receipt.gas_used,
|
||||
|
||||
@@ -122,6 +122,7 @@ pub struct RichReceipt {
|
||||
/// The gas used in the execution of the transaction. Note the difference of meaning to `Receipt::gas_used`.
|
||||
pub gas_used: U256,
|
||||
/// Contract address.
|
||||
/// NOTE: It is an Option because only `Action::Create` transactions has a contract address
|
||||
pub contract_address: Option<Address>,
|
||||
/// Logs
|
||||
pub logs: Vec<LogEntry>,
|
||||
@@ -129,6 +130,11 @@ pub struct RichReceipt {
|
||||
pub log_bloom: Bloom,
|
||||
/// Transaction outcome.
|
||||
pub outcome: TransactionOutcome,
|
||||
/// Receiver address
|
||||
/// NOTE: It is an Option because only `Action::Call` transactions has a receiver address
|
||||
pub to: Option<H160>,
|
||||
/// Sender
|
||||
pub from: H160
|
||||
}
|
||||
|
||||
/// Receipt with additional info.
|
||||
@@ -147,6 +153,7 @@ pub struct LocalizedReceipt {
|
||||
/// The gas used in the execution of the transaction. Note the difference of meaning to `Receipt::gas_used`.
|
||||
pub gas_used: U256,
|
||||
/// Contract address.
|
||||
/// NOTE: It is an Option because only `Action::Create` transactions has a contract address
|
||||
pub contract_address: Option<Address>,
|
||||
/// Logs
|
||||
pub logs: Vec<LocalizedLogEntry>,
|
||||
@@ -155,6 +162,7 @@ pub struct LocalizedReceipt {
|
||||
/// Transaction outcome.
|
||||
pub outcome: TransactionOutcome,
|
||||
/// Receiver address
|
||||
/// NOTE: It is an Option because only `Action::Call` transactions has a receiver address
|
||||
pub to: Option<H160>,
|
||||
/// Sender
|
||||
pub from: H160
|
||||
|
||||
Reference in New Issue
Block a user