code: def SaveTransaction(self, tx):
          
          coins = self.GetCoins()
          changed = []
          added = []
          deleted = []
          found_coin = False
          for input in tx.inputs:
              coin = None
  
              for coinref in coins:
                  test_coin = coinref.Reference
                  if test_coin == input:
                      coin = coinref
  
              if coin is None:
                  return False
              if coin.State & CoinState.Spent > 0:
                  return False
              elif coin.State & CoinState.Confirmed == 0:
                  return False
  
              coin.State |= CoinState.Spent
              coin.State &= ~CoinState.Confirmed
              changed.append(coin)
  
          for index, output in enumerate(tx.outputs):
  
              state = self.CheckAddressState(output.ScriptHash)
  
              key = CoinReference(tx.Hash, index)
  
              if state & AddressState.InWallet > 0:
                  newcoin = Coin.CoinFromRef(coin_ref=key, tx_output=output, state=CoinState.Unconfirmed)
                  self._coins[key] = newcoin
  
                  if state & AddressState.WatchOnly > 0:
                      newcoin.State |= CoinState.WatchOnly
  
                  added.append(newcoin)
  
          if isinstance(tx, ClaimTransaction):
              # do claim stuff
              for claim in tx.Claims:
                  claim_coin = self._coins[claim]
                  claim_coin.State |= CoinState.Claimed
                  claim_coin.State &= ~CoinState.Confirmed
                  changed.append(claim_coin)
  
          self.OnSaveTransaction(tx, added, changed, deleted)
  
          return True
docs: This method is used to after a transaction has been made by this wallet.  It updates the states of the coins
          In the wallet to reflect the new balance, but the coins remain in a ``CoinState.UNCONFIRMED`` state until
          The transaction has been processed by the network.
  
          The results of these updates can be used by overriding the ``OnSaveTransaction`` method, and, for example
          persisting the results to a database.
  
          Args:
              tx (Transaction): The transaction that has been made by this wallet.
  
          Returns:
              bool: True is successfully processes, otherwise False if input is not in the coin list, already spent or not confirmed.