From 7aefe123e98240ad4df440a8d1be4446744c8ca2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 9 Jun 2015 11:58:41 +0200 Subject: [PATCH] core/types: add Transaction.Size --- core/types/transaction.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/types/transaction.go b/core/types/transaction.go index 3d6d31ae77..a03a6b847e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -67,6 +67,13 @@ func (tx *Transaction) Hash() common.Hash { }) } +// Size returns the encoded RLP size of tx. +func (self *Transaction) Size() common.StorageSize { + c := writeCounter(0) + rlp.Encode(&c, self) + return common.StorageSize(c) +} + func (self *Transaction) Data() []byte { return self.Payload }