Skip to content

Commit

Permalink
fixed copy method (0xPolygon#1825)
Browse files Browse the repository at this point in the history
* fixed copy method

* refactored code
  • Loading branch information
rachit77 authored Aug 18, 2023
1 parent 54d4a07 commit d18818e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d18818e

Please sign in to comment.