From 7aefe123e98240ad4df440a8d1be4446744c8ca2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 9 Jun 2015 11:58:41 +0200 Subject: core/types: add Transaction.Size --- core/types/transaction.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core') diff --git a/core/types/transaction.go b/core/types/transaction.go index 3d6d31ae7..a03a6b847 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 } -- cgit v1.2.3 From 73c355591fe0279334675c555b6d614aa25b6781 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 9 Jun 2015 17:03:07 +0200 Subject: core, eth: document that result of GetTransactions is modifiable --- core/transaction_pool.go | 1 + 1 file changed, 1 insertion(+) (limited to 'core') diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 77744f8f7..918e7b957 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -247,6 +247,7 @@ func (tp *TxPool) GetTransaction(hash common.Hash) *types.Transaction { } // GetTransactions returns all currently processable transactions. +// The returned slice may be modified by the caller. func (self *TxPool) GetTransactions() (txs types.Transactions) { self.mu.Lock() defer self.mu.Unlock() -- cgit v1.2.3