File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
vms/platformvm/block/executor Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,57 @@ func TestBlockOptions(t *testing.T) {
332
332
manager : manager ,
333
333
}
334
334
},
335
+ expectedPreferenceType : & block.BanffCommitBlock {},
336
+ expectedErr : nil ,
337
+ },
338
+ {
339
+ name : "banff proposal block; can't fetch primary network validator" ,
340
+ blkF : func (ctrl * gomock.Controller ) * Block {
341
+ var (
342
+ stakerTxID = ids .GenerateTestID ()
343
+ nodeID = ids .GenerateTestNodeID ()
344
+ subnetID = ids .GenerateTestID ()
345
+ stakerTx = & txs.Tx {
346
+ Unsigned : & txs.AddPermissionlessValidatorTx {
347
+ Validator : txs.Validator {
348
+ NodeID : nodeID ,
349
+ },
350
+ Subnet : subnetID ,
351
+ },
352
+ }
353
+ )
354
+
355
+ state := state .NewMockState (ctrl )
356
+ state .EXPECT ().GetTx (stakerTxID ).Return (stakerTx , status .Committed , nil )
357
+ state .EXPECT ().GetCurrentValidator (constants .PrimaryNetworkID , nodeID ).Return (nil , database .ErrClosed )
358
+
359
+ uptimes := uptime .NewMockCalculator (ctrl )
360
+
361
+ manager := & manager {
362
+ backend : & backend {
363
+ state : state ,
364
+ },
365
+ txExecutorBackend : & executor.Backend {
366
+ Config : & config.Config {
367
+ UptimePercentage : 0 ,
368
+ },
369
+ Uptimes : uptimes ,
370
+ },
371
+ }
372
+
373
+ return & Block {
374
+ Block : & block.BanffProposalBlock {
375
+ ApricotProposalBlock : block.ApricotProposalBlock {
376
+ Tx : & txs.Tx {
377
+ Unsigned : & txs.RewardValidatorTx {
378
+ TxID : stakerTxID ,
379
+ },
380
+ },
381
+ },
382
+ },
383
+ manager : manager ,
384
+ }
385
+ },
335
386
expectedPreferenceType : nil ,
336
387
expectedErr : executor .ErrStakerWithoutPrimaryNetworkValidator ,
337
388
},
You can’t perform that action at this time.
0 commit comments