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

Function ReadScript

model/script/script.go:410–429  ·  view source on GitHub ↗
(reader io.Reader, maxAllowed uint32, fieldName string)

Source from the content-addressed store, hash-verified

408}
409
410func ReadScript(reader io.Reader, maxAllowed uint32, fieldName string) (script []byte, err error) {
411 count, err := util.ReadVarInt(reader)
412 if err != nil {
413 return
414 }
415 if count > uint64(maxAllowed) {
416 log.Debug("ReadScript size err")
417 err = errcode.New(errcode.ScriptErrScriptSize)
418 return
419 }
420 //buf := scriptPool.Borrow(count)
421 script = make([]byte, count)
422 _, err = io.ReadFull(reader, script)
423 if err != nil {
424 //scriptPool.Return(buf)
425 return
426 }
427 return script, nil
428
429}
430
431func (s *Script) ExtractDestinations() (sType int, addresses []*Address, sigCountRequired int, err error) {
432 sType, pubKeys, isStandard := s.IsStandardScriptPubKey()

Callers 1

DecodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected