func gen_account() { privAccount := account.GenPrivAccount() privAccountJSONBytes := binary.JSONBytes(privAccount) fmt.Printf(`Generated a new account! %v `, string(privAccountJSONBytes), ) }
func RandAccount(randBalance bool, minBalance uint64) (*account.Account, *account.PrivAccount) { privAccount := account.GenPrivAccount() acc := &account.Account{ Address: privAccount.PubKey.Address(), PubKey: privAccount.PubKey, Sequence: RandUint(), Balance: minBalance, } if randBalance { acc.Balance += uint64(RandUint32()) } return acc, privAccount }
func RandAccount(randBalance bool, minBalance int64) (*acm.Account, *acm.PrivAccount) { privAccount := acm.GenPrivAccount() perms := ptypes.DefaultAccountPermissions acc := &acm.Account{ Address: privAccount.PubKey.Address(), PubKey: privAccount.PubKey, Sequence: RandInt(), Balance: minBalance, Permissions: perms, } if randBalance { acc.Balance += int64(RandUint32()) } return acc, privAccount }
func BenchmarkValidatorSetCopy(b *testing.B) { b.StopTimer() vset := NewValidatorSet([]*Validator{}) for i := 0; i < 1000; i++ { privAccount := account.GenPrivAccount() val := &Validator{ Address: privAccount.Address, PubKey: privAccount.PubKey.(account.PubKeyEd25519), } if !vset.Add(val) { panic("Failed to add validator") } } b.StartTimer() for i := 0; i < b.N; i++ { vset.Copy() } }
func GenPrivAccount() (*ctypes.ResultGenPrivAccount, error) { return &ctypes.ResultGenPrivAccount{acm.GenPrivAccount()}, nil }