From 10b956f75fb028a74e7289a1023f52d44477c30b Mon Sep 17 00:00:00 2001 From: Gabriel-Trintinalia Date: Wed, 4 Oct 2023 19:18:49 +1100 Subject: [PATCH] Expose getSize to transaction interface (#5983) Signed-off-by: Gabriel-Trintinalia --- .../java/org/hyperledger/besu/datatypes/Transaction.java | 7 +++++++ .../org/hyperledger/besu/ethereum/core/Transaction.java | 1 + 2 files changed, 8 insertions(+) diff --git a/datatypes/src/main/java/org/hyperledger/besu/datatypes/Transaction.java b/datatypes/src/main/java/org/hyperledger/besu/datatypes/Transaction.java index d70ceda40d..3407513ca7 100644 --- a/datatypes/src/main/java/org/hyperledger/besu/datatypes/Transaction.java +++ b/datatypes/src/main/java/org/hyperledger/besu/datatypes/Transaction.java @@ -219,4 +219,11 @@ public interface Transaction { * @return the encoded transaction as Bytes */ Bytes encoded(); + + /** + * Returns the size in bytes of the encoded transaction. + * + * @return the size in bytes of the encoded transaction. + */ + int getSize(); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java index a7cad4b8d8..0133e0bd72 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java @@ -670,6 +670,7 @@ public class Transaction * * @return the size in bytes of the encoded transaction. */ + @Override public int getSize() { if (size == -1) { memoizeHashAndSize();