added two methods to transaction struct

This commit is contained in:
debris 2015-12-09 02:09:42 +01:00
parent 421d2d1174
commit 1468145110

View File

@ -11,6 +11,16 @@ pub struct Transaction {
data: Vec<u8>, data: Vec<u8>,
} }
impl Transaction {
pub fn is_contract_creation(&self) -> bool {
self.receive_address.is_none()
}
pub fn is_message_call(&self) -> bool {
!self.is_contract_creation()
}
}
impl Encodable for Transaction { impl Encodable for Transaction {
fn encode<E>(&self, encoder: &mut E) where E: Encoder { fn encode<E>(&self, encoder: &mut E) where E: Encoder {
encoder.emit_list(| e | { encoder.emit_list(| e | {