@@ -138,6 +138,21 @@ func (s *VestingTestSuite) TestCreateVestingAccount() {
138138 expErr : true ,
139139 expErrMsg : "already exists" ,
140140 },
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+ },
141156 "create a valid delayed vesting account" : {
142157 preRun : func () {
143158 s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), fooCoin ).Return (nil )
@@ -237,6 +252,22 @@ func (s *VestingTestSuite) TestCreatePermanentLockedAccount() {
237252 expErr : true ,
238253 expErrMsg : "already exists" ,
239254 },
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+
240271 "create a valid permanent locked account" : {
241272 preRun : func () {
242273 s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), fooCoin ).Return (nil )
@@ -361,6 +392,7 @@ func (s *VestingTestSuite) TestCreatePeriodicVestingAccount() {
361392 {
362393 name : "create for existing account" ,
363394 preRun : func () {
395+ s .bankKeeper .EXPECT ().BlockedAddr (to1Addr ).Return (false )
364396 toAcc := s .accountKeeper .NewAccountWithAddress (s .ctx , to1Addr )
365397 s .accountKeeper .SetAccount (s .ctx , toAcc )
366398 },
@@ -378,10 +410,34 @@ func (s *VestingTestSuite) TestCreatePeriodicVestingAccount() {
378410 expErr : true ,
379411 expErrMsg : "already exists" ,
380412 },
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+ },
381436 {
382437 name : "create a valid periodic vesting account" ,
383438 preRun : func () {
384439 s .bankKeeper .EXPECT ().IsSendEnabledCoins (gomock .Any (), periodCoin .Add (fooCoin )).Return (nil )
440+ s .bankKeeper .EXPECT ().BlockedAddr (to2Addr ).Return (false )
385441 s .bankKeeper .EXPECT ().SendCoins (gomock .Any (), fromAddr , to2Addr , gomock .Any ()).Return (nil )
386442 },
387443 input : vestingtypes .NewMsgCreatePeriodicVestingAccount (
0 commit comments