コード例 #1
0
ファイル: p2pnode.py プロジェクト: slush0/stratum-bitcoin
    def broadcast_tx(self, txdata):
        '''Broadcast new transaction (as a hex stream) to trusted node'''
        tx = halfnode.msg_tx()
        tx.deserialize(StringIO.StringIO(binascii.unhexlify(txdata)))
        
        alternate = get_alternate_connection()
        d = alternate.observe_tx("%x" % tx.tx.calc_sha256(), 5)

        self.send_message(tx)
        
        # Defer will throw confirm when alternate connection
        # confirm that tx has been broadcasted or errback on timeouts
        return d
コード例 #2
0
    def broadcast_tx(self, txdata):
        '''Broadcast new transaction (as a hex stream) to trusted node'''
        tx = halfnode.msg_tx()
        tx.deserialize(StringIO.StringIO(binascii.unhexlify(txdata)))

        alternate = get_alternate_connection()
        d = alternate.observe_tx("%x" % tx.tx.calc_sha256(), 5)

        self.send_message(tx)

        # Defer will throw confirm when alternate connection
        # confirm that tx has been broadcasted or errback on timeouts
        return d
コード例 #3
0
ファイル: __init__.py プロジェクト: MasterScott/sendtx
    def connectionMade(self):
        halfnode.BitcoinP2PProtocol.connectionMade(self)

        if self.on_connect:
            log("Checking connection ready")
            self.on_connect.callback(True)
            self.on_connect = None

        if self.send_or_check == True:
            # We're sending transaction
            self.broadcast_tx(self.tx)
            log("Transaction broadcasted to the network")
        else:
            # We're watching transaction
            tx = halfnode.msg_tx()
            tx.deserialize(StringIO.StringIO(binascii.unhexlify(self.tx)))
            tx.tx.calc_sha256()
            self.txhash = tx.tx.sha256
            log("Watching the network for %x" % self.txhash)
コード例 #4
0
ファイル: __init__.py プロジェクト: edmundedgar/sendtx
    def connectionMade(self):
        halfnode.BitcoinP2PProtocol.connectionMade(self)
        
        if self.on_connect:
            log("Checking connection ready")
            self.on_connect.callback(True)
            self.on_connect = None

        if self.send_or_check == True:
            # We're sending transaction
            self.broadcast_tx(self.tx)
            log("Transaction broadcasted to the network")
        else:
            # We're watching transaction
            tx = halfnode.msg_tx()
            tx.deserialize(StringIO.StringIO(binascii.unhexlify(self.tx)))
            tx.tx.calc_sha256()
            self.txhash = tx.tx.sha256
            log("Watching the network for %x" % self.txhash)
コード例 #5
0
ファイル: __init__.py プロジェクト: MasterScott/sendtx
 def broadcast_tx(self, txdata):
     '''Broadcast new transaction (as a hex stream) to trusted node'''
     tx = halfnode.msg_tx()
     tx.deserialize(StringIO.StringIO(binascii.unhexlify(txdata)))
     self.send_message(tx)
コード例 #6
0
ファイル: __init__.py プロジェクト: edmundedgar/sendtx
 def broadcast_tx(self, txdata):
     '''Broadcast new transaction (as a hex stream) to trusted node'''
     tx = halfnode.msg_tx()
     tx.deserialize(StringIO.StringIO(binascii.unhexlify(txdata)))
     self.send_message(tx)