lotus/chain/address/testing.go
2019-07-05 16:36:08 +02:00

21 lines
408 B
Go

package address
import (
"fmt"
)
// NewForTestGetter returns a closure that returns an address unique to that invocation.
// The address is unique wrt the closure returned, not globally.
func NewForTestGetter() func() Address {
i := 0
return func() Address {
s := fmt.Sprintf("address%d", i)
i++
newAddr, err := NewActorAddress([]byte(s))
if err != nil {
panic(err)
}
return newAddr
}
}