Пример #1
0
    def Rebuild(self):
        super(UserWallet, self).Rebuild()

        for c in Coin.select():
            c.delete_instance()
        for tx in Transaction.select():
            tx.delete_instance()

        self.__log.debug("deleted coins and transactions %s %s " %
                         (Coin.select().count(), Transaction.select().count()))
Пример #2
0
    def Rebuild(self):
        try:
            super(UserWallet, self).Rebuild()

            logger.debug("wallet rebuild: deleting %s coins and %s transactions" %
                         (Coin.select().count(), Transaction.select().count()))

            for c in Coin.select():
                c.delete_instance()
            for tx in Transaction.select():
                tx.delete_instance()
        except Exception as e:
            print("Could not rebuild %s " % e)
    def Rebuild(self):
        self._lock.acquire()
        try:
            super(UserWallet, self).Rebuild()

            logger.debug("wallet rebuild: deleting %s coins and %s transactions" %
                         (Coin.select().count(), Transaction.select().count()))

            for c in Coin.select():
                c.delete_instance()
            for tx in Transaction.select():
                tx.delete_instance()
        finally:
            self._lock.release()

        logger.debug("wallet rebuild complete")
Пример #4
0
    def Rebuild(self):
        self._lock.acquire()
        try:
            super(UserWallet, self).Rebuild()

            logger.debug("wallet rebuild: deleting %s coins and %s transactions" %
                         (Coin.select().count(), Transaction.select().count()))

            for c in Coin.select():
                c.delete_instance()
            for tx in Transaction.select():
                tx.delete_instance()
        finally:
            self._lock.release()

        logger.debug("wallet rebuild complete")
Пример #5
0
    def LoadCoins(self):
        coins = {}

        try:
            for coin in Coin.select():
                reference = CoinReference(prev_hash=UInt256(coin.TxId), prev_index=coin.Index)
                output = TransactionOutput(UInt256(coin.AssetId), Fixed8(coin.Value), UInt160(coin.ScriptHash))
                walletcoin = WalletCoin.CoinFromRef(reference, output, coin.State)
                coins[reference] = walletcoin
        except Exception as e:
            logger.error("could not load coins %s " % e)

        return coins
Пример #6
0
    def LoadCoins(self):
        coins = {}

        try:
            for coin in Coin.select():
                reference = CoinReference(prev_hash=UInt256(coin.TxId), prev_index=coin.Index)
                output = TransactionOutput(UInt256(coin.AssetId), Fixed8(coin.Value), UInt160(coin.ScriptHash))
                walletcoin = WalletCoin.CoinFromRef(reference, output, coin.State)
                coins[reference] = walletcoin
        except Exception as e:
            logger.error("could not load coins %s " % e)

        return coins