From d18818e1b85dbcb540963ff17f672a1c65a602e7 Mon Sep 17 00:00:00 2001 From: Rachit Sonthalia <54906134+rachit77@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:48:50 +0530 Subject: [PATCH] fixed copy method (#1825) * fixed copy method * refactored code --- types/transaction.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/transaction.go b/types/transaction.go index 1101998c49..190a8ff136 100644 --- a/types/transaction.go +++ b/types/transaction.go @@ -105,14 +105,16 @@ func (t *Transaction) Copy() *Transaction { tt.Value.Set(t.Value) } + if t.V != nil { + tt.V = new(big.Int).Set(t.V) + } + if t.R != nil { - tt.R = new(big.Int) - tt.R = big.NewInt(0).SetBits(t.R.Bits()) + tt.R = new(big.Int).Set(t.R) } if t.S != nil { - tt.S = new(big.Int) - tt.S = big.NewInt(0).SetBits(t.S.Bits()) + tt.S = new(big.Int).Set(t.S) } tt.Input = make([]byte, len(t.Input))