(k proto.AccountAddress, amount uint64, tokenType types.TokenType)
| 270 | } |
| 271 | |
| 272 | func (s *metaState) decreaseAccountToken(k proto.AccountAddress, amount uint64, tokenType types.TokenType) error { |
| 273 | var ( |
| 274 | src, dst *types.Account |
| 275 | ok bool |
| 276 | ) |
| 277 | if dst, ok = s.dirty.accounts[k]; !ok { |
| 278 | if src, ok = s.readonly.accounts[k]; !ok { |
| 279 | err := errors.Wrap(ErrAccountNotFound, "decrease account balance fail") |
| 280 | return err |
| 281 | } |
| 282 | dst = deepcopy.Copy(src).(*types.Account) |
| 283 | s.dirty.accounts[k] = dst |
| 284 | } |
| 285 | return safeSub(&dst.TokenBalance[tokenType], &amount) |
| 286 | } |
| 287 | |
| 288 | func (s *metaState) increaseAccountStableBalance(k proto.AccountAddress, amount uint64) error { |
| 289 | return s.increaseAccountToken(k, amount, types.Particle) |
no test coverage detected