def locked(self):
     """
     Total available coins that are locked.
     """
     if self.chain_time > 0 and self.chain_height > 0:
         return (sum([
             co.value for co in self._outputs.values() if co.condition.lock.
             locked_check(time=self.chain_time, height=self.chain_height)
         ]) or Currency())
     else:
         return Currency(
             value=0
         )  # impossible to know for sure without a complete context
 def _human_readable_balance(self):
     # report confirmed coins
     result = "{} available and {} locked".format(
         self.available.str(with_unit=True), self.locked.str(with_unit=True)
     )
     # optionally report unconfirmed coins
     unconfirmed = self.unconfirmed
     unconfirmed_locked = self.unconfirmed_locked
     if unconfirmed > 0 or unconfirmed_locked > 0:
         result += "\nUnconfirmed: {} available {} locked".format(
             unconfirmed.str(with_unit=True), unconfirmed_locked.str(with_unit=True)
         )
     unconfirmed_spent = Currency(value=sum([co.value for co in self._outputs_unconfirmed_spent.values()]))
     if unconfirmed_spent > 0:
         result += "\nUnconfirmed Balance Deduction: -{}".format(unconfirmed_spent.str(with_unit=True))
     # return report
     return result
 def unconfirmed(self):
     """
     Total unconfirmed coins, available for spending.
     """
     if self.chain_time > 0 and self.chain_height > 0:
         return (sum([
             co.value for co in self._outputs_unconfirmed.values()
             if not co.condition.lock.locked_check(time=self.chain_time,
                                                   height=self.chain_height)
         ]) or Currency())
     else:
         return sum([co.value for co in self._outputs_unconfirmed.values()])
 def available(self):
     """
     Total available coins.
     """
     return sum([co.value for co in self.outputs_available]) or Currency()