MCPcopy Create free account
hub / github.com/chain/Core / TestVerifyBlockHeaderQuickCheck

Function TestVerifyBlockHeaderQuickCheck

protocol/vm/vm_test.go:439–465  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

437}
438
439func TestVerifyBlockHeaderQuickCheck(t *testing.T) {
440 f := func(program []byte, witnesses [][]byte) (ok bool) {
441 defer func() {
442 if err := recover(); err != nil {
443 t.Log(decompile(program))
444 for i := range witnesses {
445 t.Logf("witness %d: %x\n", i, witnesses[i])
446 }
447 t.Log(err)
448 ok = false
449 }
450 }()
451 context := &Context{
452 VMVersion: 1,
453 Code: program,
454 Arguments: witnesses,
455 BlockHash: new([]byte),
456 BlockTimeMS: new(uint64),
457 NextConsensusProgram: &[]byte{},
458 }
459 Verify(context)
460 return true
461 }
462 if err := quick.Check(f, nil); err != nil {
463 t.Error(err)
464 }
465}

Callers

nothing calls this directly

Calls 5

decompileFunction · 0.85
LogMethod · 0.80
CheckMethod · 0.80
VerifyFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected