@@ -138,6 +138,21 @@ func (s *VestingTestSuite) TestCreateVestingAccount() {
138
138
expErr : true ,
139
139
expErrMsg : "already exists" ,
140
140
},
141
+ "create for blocked account" : {
142
+ preRun : func () {
143
+ s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), fooCoin ).Return (nil )
144
+ s .bankKeeper .EXPECT ().BlockedAddr (to1Addr ).Return (true )
145
+ },
146
+ input : vestingtypes .NewMsgCreateVestingAccount (
147
+ fromAddr ,
148
+ to1Addr ,
149
+ sdk.Coins {fooCoin },
150
+ time .Now ().Unix (),
151
+ true ,
152
+ ),
153
+ expErr : true ,
154
+ expErrMsg : "not allowed to receive funds" ,
155
+ },
141
156
"create a valid delayed vesting account" : {
142
157
preRun : func () {
143
158
s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), fooCoin ).Return (nil )
@@ -237,6 +252,22 @@ func (s *VestingTestSuite) TestCreatePermanentLockedAccount() {
237
252
expErr : true ,
238
253
expErrMsg : "already exists" ,
239
254
},
255
+ "create for blocked account" : {
256
+ preRun : func () {
257
+ toAcc := s .accountKeeper .NewAccountWithAddress (s .ctx , to1Addr )
258
+ s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), fooCoin ).Return (nil )
259
+ s .bankKeeper .EXPECT ().BlockedAddr (to1Addr ).Return (true )
260
+ s .accountKeeper .SetAccount (s .ctx , toAcc )
261
+ },
262
+ input : vestingtypes .NewMsgCreatePermanentLockedAccount (
263
+ fromAddr ,
264
+ to1Addr ,
265
+ sdk.Coins {fooCoin },
266
+ ),
267
+ expErr : true ,
268
+ expErrMsg : "not allowed to receive funds" ,
269
+ },
270
+
240
271
"create a valid permanent locked account" : {
241
272
preRun : func () {
242
273
s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), fooCoin ).Return (nil )
@@ -361,6 +392,7 @@ func (s *VestingTestSuite) TestCreatePeriodicVestingAccount() {
361
392
{
362
393
name : "create for existing account" ,
363
394
preRun : func () {
395
+ s .bankKeeper .EXPECT ().BlockedAddr (to1Addr ).Return (false )
364
396
toAcc := s .accountKeeper .NewAccountWithAddress (s .ctx , to1Addr )
365
397
s .accountKeeper .SetAccount (s .ctx , toAcc )
366
398
},
@@ -378,10 +410,34 @@ func (s *VestingTestSuite) TestCreatePeriodicVestingAccount() {
378
410
expErr : true ,
379
411
expErrMsg : "already exists" ,
380
412
},
413
+ {
414
+ name : "create for blocked address" ,
415
+ preRun : func () {
416
+ s .bankKeeper .EXPECT ().BlockedAddr (to2Addr ).Return (true )
417
+ },
418
+ input : vestingtypes .NewMsgCreatePeriodicVestingAccount (
419
+ fromAddr ,
420
+ to2Addr ,
421
+ time .Now ().Unix (),
422
+ []vestingtypes.Period {
423
+ {
424
+ Length : 10 ,
425
+ Amount : sdk .NewCoins (periodCoin ),
426
+ },
427
+ {
428
+ Length : 20 ,
429
+ Amount : sdk .NewCoins (fooCoin ),
430
+ },
431
+ },
432
+ ),
433
+ expErr : true ,
434
+ expErrMsg : "not allowed to receive funds" ,
435
+ },
381
436
{
382
437
name : "create a valid periodic vesting account" ,
383
438
preRun : func () {
384
439
s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), periodCoin .Add (fooCoin )).Return (nil )
440
+ s .bankKeeper .EXPECT ().BlockedAddr (to2Addr ).Return (false )
385
441
s .bankKeeper .EXPECT ().SendCoins (gomock .Any (), fromAddr , to2Addr , gomock .Any ()).Return (nil )
386
442
},
387
443
input : vestingtypes .NewMsgCreatePeriodicVestingAccount (
0 commit comments