def onCoinsReceived(self, w, tx, pb, nb):
        v = tx.getValueSentToMe(w)
        logger.debug("tx received %s" % (tx))
        for to in tx.getOutputs():
            logger.debug(to)
            toa = to.getAddressFromP2PKHScript(params)
            if toa:
                addr = toa.toString()
                logger.debug("receiver address: %s" % addr)

        class myFutureCallback(FutureCallback):
            def __init__(self, tx):
                self.trx = tx

            @loud_exceptions
            def onSuccess(self, txn):
                valueConfirmed = v.getValue()
                logger.debug("confirmed: %s" % valueConfirmed)
                for to in self.trx.getOutputs():
                    rcv_address = to.getAddressFromP2PKHScript(params)
                    if rcv_address:
                        logger.debug("confirmed receiver address: %s" %
                                     rcv_address.toString())

        Futures.addCallback(
            tx.getConfidence().getDepthFuture(confirmationsRequired),
            myFutureCallback(tx))
Example #2
0
    def onCoinsReceived(self, w, tx, pb, nb):
        print "tx received", tx
        v = tx.getValueSentToMe(w)

        class myFutureCallback(FutureCallback):
            @loud_exceptions
            def onSuccess(selfx, txn):
                forwardCoins(tx,w,self.peerGroup, self.address)

        print "creating %s confirm callback..." % (confirm_wait)
        Futures.addCallback(tx.getConfidence().getDepthFuture(confirm_wait), myFutureCallback())
Example #3
0
    def onCoinsReceived(self, w, tx, pb, nb):
        print "tx received", tx
        v = tx.getValueSentToMe(w)

        class myFutureCallback(FutureCallback):
            @loud_exceptions
            def onSuccess(selfx, txn):
                forwardCoins(tx,w,self.peerGroup, self.address)

        print "creating %s confirm callback..." % (confirm_wait)
        Futures.addCallback(tx.getConfidence().getDepthFuture(confirm_wait), myFutureCallback())