rpc: fix address formatting in TransactionRequest Display (#8786)

* rpc: fix address formatting in TransactionRequest Display

* rpc: use unwrap_or_else when no to address provided
This commit is contained in:
André Silva 2018-06-05 08:58:09 +01:00 committed by Afri Schoedon
parent e2a90ce159
commit b3ea766bd5

View File

@ -69,14 +69,20 @@ impl fmt::Display for TransactionRequest {
f,
"{} ETH from {} to 0x{:?}",
Colour::White.bold().paint(format_ether(eth)),
Colour::White.bold().paint(format!("0x{:?}", self.from)),
Colour::White.bold().paint(
self.from.as_ref()
.map(|f| format!("0x{:?}", f))
.unwrap_or_else(|| "?".to_string())),
to
),
None => write!(
f,
"{} ETH from {} for contract creation",
Colour::White.bold().paint(format_ether(eth)),
Colour::White.bold().paint(format!("0x{:?}", self.from)),
Colour::White.bold().paint(
self.from.as_ref()
.map(|f| format!("0x{:?}", f))
.unwrap_or_else(|| "?".to_string())),
),
}
}