MCPcopy Create free account
hub / github.com/chain/txvm / chargeCopy

Method chargeCopy

protocol/txvm/vm.go:287–303  ·  view source on GitHub ↗
(v Data)

Source from the content-addressed store, hash-verified

285}
286
287func (vm *VM) chargeCopy(v Data) {
288 var (
289 cost int64
290 ok = true
291 )
292
293 switch val := v.(type) {
294 case Bytes:
295 cost, ok = checked.AddInt64(1, int64(len(val)))
296 case Tuple:
297 cost, ok = checked.AddInt64(1, int64(len(val)))
298 }
299 if !ok {
300 panic(errors.Wrap(ErrIntOverflow, "charging copy cost"))
301 }
302 vm.charge(cost)
303}
304
305// perr must be non-nil
306func (vm *VM) recoverError(perr *error) {

Callers 11

opContractProgramFunction · 0.80
opSelfFunction · 0.80
opSeedFunction · 0.80
opCallerFunction · 0.80
opAnchorFunction · 0.80
opTxIDFunction · 0.80
opAssetIDFunction · 0.80
opPeekFunction · 0.80
opPeekLogFunction · 0.80
opDupFunction · 0.80
opFieldFunction · 0.80

Calls 3

chargeMethod · 0.95
AddInt64Function · 0.92
WrapFunction · 0.92

Tested by

no test coverage detected