MCPcopy Create free account
hub / github.com/copernet/copernicus / IsCommitment

Method IsCommitment

model/script/script.go:481–497  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

479}
480
481func (s *Script) IsCommitment(data []byte) bool {
482 if len(data) > 64 || s.Size() != len(data)+2 {
483 return false
484 }
485
486 if s.data[0] != opcodes.OP_RETURN || int(s.data[1]) != len(data) {
487 return false
488 }
489
490 for i := 0; i < len(data); i++ {
491 if s.data[i+2] != data[i] {
492 return false
493 }
494 }
495
496 return true
497}
498
499func BytesToBool(bytes []byte) bool {
500 bytesLen := len(bytes)

Callers 2

TestScript_IsCommitmentFunction · 0.80
TestIsCommitmentFunction · 0.80

Calls 1

SizeMethod · 0.95

Tested by 2

TestScript_IsCommitmentFunction · 0.64
TestIsCommitmentFunction · 0.64