Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-lashin committed Oct 14, 2020
1 parent 221b66e commit 2f0c6d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/state/coins/coins.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ func (c *Coins) Recreate(newID types.CoinID, name string, symbol types.CoinSymbo

func (c *Coins) ChangeOwner(symbol types.CoinSymbol, owner types.Address) {
info := c.getSymbolInfo(symbol)
info.SetOwnerAddress(&owner)
info.setOwnerAddress(owner)

coin := c.GetCoinBySymbol(symbol, 0)
coin.symbolInfo = info

c.setToMap(coin.id, coin)
c.setToMap(coin.ID(), coin)
c.markDirty(coin.ID())
}

Expand Down
4 changes: 2 additions & 2 deletions core/state/coins/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ type SymbolInfo struct {
isDirty bool
}

func (i *SymbolInfo) SetOwnerAddress(address *types.Address) {
i.COwnerAddress = address
func (i *SymbolInfo) setOwnerAddress(address types.Address) {
i.COwnerAddress = &address
i.isDirty = true
}

Expand Down
2 changes: 1 addition & 1 deletion core/transaction/edit_coin_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (data EditCoinOwnerData) BasicCheck(tx *Transaction, context *state.CheckSt
}
}

if info.OwnerAddress() == nil || info.OwnerAddress().Compare(sender) != 0 {
if info.OwnerAddress() == nil || *info.OwnerAddress() != sender {
owner := info.OwnerAddress().String()
return &Response{
Code: code.IsNotOwnerOfCoin,
Expand Down

0 comments on commit 2f0c6d3

Please sign in to comment.