From c89dee502a5f3812fc536a261c46efc81a770e45 Mon Sep 17 00:00:00 2001 From: James Prestwich <10149425+prestwich@users.noreply.github.com> Date: Mon, 18 Nov 2019 18:39:33 -0800 Subject: [PATCH] Add BigInt() to Uint struct in types/uint.go, update tests to check ident (#5325) --- types/uint.go | 5 +++++ types/uint_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/types/uint.go b/types/uint.go index 4bb71fff04..a6c4a0abf9 100644 --- a/types/uint.go +++ b/types/uint.go @@ -13,6 +13,11 @@ type Uint struct { i *big.Int } +// BigInt converts Uint to big.Int +func (u Uint) BigInt() *big.Int { + return new(big.Int).Set(u.i) +} + // NewUintFromBigUint constructs Uint from big.Uint func NewUintFromBigInt(i *big.Int) Uint { u, err := checkNewUint(i) diff --git a/types/uint_test.go b/types/uint_test.go index 167f65284d..34fc1780ba 100644 --- a/types/uint_test.go +++ b/types/uint_test.go @@ -84,6 +84,7 @@ func TestIdentUint(t *testing.T) { cases := []uint64{ i.Uint64(), + i.BigInt().Uint64(), i.i.Uint64(), ifromstr.Uint64(), NewUintFromBigInt(new(big.Int).SetUint64(n)).Uint64(),