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

Method chargeCreate

protocol/txvm/vm.go:267–285  ·  view source on GitHub ↗
(v Item)

Source from the content-addressed store, hash-verified

265}
266
267func (vm *VM) chargeCreate(v Item) {
268 var (
269 cost int64
270 ok = true
271 )
272
273 switch val := v.(type) {
274 case Entry:
275 cost = 128
276 case Bytes:
277 cost, ok = checked.AddInt64(1, int64(len(val)))
278 case Tuple:
279 cost, ok = checked.AddInt64(1, int64(len(val)))
280 }
281 if !ok {
282 panic(errors.Wrap(ErrIntOverflow, "charging create cost"))
283 }
284 vm.charge(cost)
285}
286
287func (vm *VM) chargeCopy(v Data) {
288 var (

Callers 13

stepMethod · 0.95
logMethod · 0.95
opOutputFunction · 0.80
opInputFunction · 0.80
opBitNotFunction · 0.80
bitOpFunction · 0.80
opCatFunction · 0.80
opSliceFunction · 0.80
opVMHashFunction · 0.80
opSHA256Function · 0.80
opSHA3Function · 0.80
opTupleFunction · 0.80

Calls 3

chargeMethod · 0.95
AddInt64Function · 0.92
WrapFunction · 0.92

Tested by

no test coverage detected