MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / increaseAccountToken

Method increaseAccountToken

blockproducer/metastate.go:256–270  ·  view source on GitHub ↗
(k proto.AccountAddress, amount uint64, tokenType types.TokenType)

Source from the content-addressed store, hash-verified

254}
255
256func (s *metaState) increaseAccountToken(k proto.AccountAddress, amount uint64, tokenType types.TokenType) error {
257 var (
258 src, dst *types.Account
259 ok bool
260 )
261 if dst, ok = s.dirty.accounts[k]; !ok {
262 if src, ok = s.readonly.accounts[k]; !ok {
263 err := errors.Wrap(ErrAccountNotFound, "increase account balance fail")
264 return err
265 }
266 dst = deepcopy.Copy(src).(*types.Account)
267 s.dirty.accounts[k] = dst
268 }
269 return safeAdd(&dst.TokenBalance[tokenType], &amount)
270}
271
272func (s *metaState) decreaseAccountToken(k proto.AccountAddress, amount uint64, tokenType types.TokenType) error {
273 var (

Calls 1

safeAddFunction · 0.85

Tested by

no test coverage detected