Пример #1
0
def refill_payment_queue():
    c=Payment.objects.filter(active=False).count()
    if settings.BITCOIN_PAYMENT_BUFFER_SIZE>c:
        for i in range(0,settings.BITCOIN_PAYMENT_BUFFER_SIZE-c):
            bp=Payment()
            bp.address=bitcoind.create_address()
            bp.save()
    c=BitcoinAddress.objects.filter(active=False).count()
    if settings.BITCOIN_ADDRESS_BUFFER_SIZE>c:
        for i in range(0,settings.BITCOIN_ADDRESS_BUFFER_SIZE-c):
            ba=BitcoinAddress()
            ba.address=bitcoind.create_address()
            ba.save()
Пример #2
0
def refill_payment_queue():
    c = BitcoinAddress.objects.filter(active=False, wallet=None).count()
    # print "count", c
    if settings.BITCOIN_ADDRESS_BUFFER_SIZE > c:
        for i in range(0, settings.BITCOIN_ADDRESS_BUFFER_SIZE - c):
            BitcoinAddress.objects.create(address=bitcoind.create_address(),
                                          active=False)
Пример #3
0
 def receiving_address(self, fresh_addr=True):
     usable_addresses = self.addresses.filter(active=True).order_by("id")
     if fresh_addr:
         usable_addresses = usable_addresses.filter(least_received=Decimal(0))
     if usable_addresses.count():
         return usable_addresses[0].address
     addr = BitcoinAddress.objects.create(address = bitcoind.create_address(), active=True, wallet=self)
     print "addr_id", addr.id, updated
     return addr.address
Пример #4
0
def refill_payment_queue():
    c=BitcoinAddress.objects.filter(active=False, wallet=None).count()
    # print "count", c
    if settings.BITCOIN_ADDRESS_BUFFER_SIZE>c:
        for i in range(0,settings.BITCOIN_ADDRESS_BUFFER_SIZE-c):
            BitcoinAddress.objects.create(address = bitcoind.create_address(), active=False)
Пример #5
0
def new_bitcoin_address():
    bp = BitcoinAddress.objects.create(address = bitcoind.create_address(), active=True)
    return bp