예제 #1
0
    def stopBitcoind(self):
        LOGINFO('Called stopBitcoind')
        if self.bitcoind == False:
            self.bitcoind = None
            return
        try:
            if not self.isRunningBitcoind():
                LOGINFO('...but bitcoind is not running, to be able to stop')
                return

            from armoryengine.BDM import TheBDM
            cookie = TheBDM.getCookie()
            TheBDM.bdv().shutdownNode(cookie)

            #poll the pid until it's gone, for as long as 2 minutes
            total = 0
            while self.bitcoind.poll() == None:
                time.sleep(0.1)
                total += 1

                if total > 1200:
                    LOGERROR(
                        "bitcoind failed to shutdown in less than 2 minutes."
                        " Terminating.")
                    return

            self.bitcoind = None
        except Exception as e:
            LOGERROR(e)
            return
예제 #2
0
파일: SDM.py 프로젝트: Rudd-O/BitcoinArmory
   def stopBitcoind(self):
      LOGINFO('Called stopBitcoind')
      if self.bitcoind == False:
         self.bitcoind = None
         return
      try:
         if not self.isRunningBitcoind():
            LOGINFO('...but bitcoind is not running, to be able to stop')
            return
         
         from armoryengine.BDM import TheBDM
         cookie = TheBDM.getCookie()
         TheBDM.bdv().shutdownNode(cookie);

         #poll the pid until it's gone, for as long as 2 minutes
         total = 0
         while self.bitcoind.poll()==None:
            time.sleep(0.1)
            total += 1

            if total > 1200:
               LOGERROR("bitcoind failed to shutdown in less than 2 minutes."
                      " Terminating.")
               return

         self.bitcoind = None
      except Exception as e:
         LOGERROR(e)
         return
예제 #3
0
    def setup(self):
        rbfList = self.wallet.getRBFTxOutList()

        self.rbfDict = {}

        #order outputs by parent hash
        for utxo in rbfList:
            parentHash = utxo.getTxHashStr()
            if not parentHash in self.rbfDict:
                self.rbfDict[parentHash] = []

            utxoList = self.rbfDict[parentHash]
            utxoList.append(utxo)

        for txhash in self.rbfDict:
            #get outpoints for spender tx
            entryList = self.rbfDict[txhash]
            cppTx = TheBDM.bdv().getTxByHash(txhash)

            if cppTx.isInitialized():
                pytx = PyTx().unserialize(cppTx.serialize())
            else:
                continue

            for _input in pytx.inputs:
                spentHash = _input.outpoint.txHash

                #if this tx redeems an output in our list of RBF tx,
                #link it to the spendee
                if spentHash in self.rbfDict:
                    spendeeList = self.rbfDict[spentHash]
                    spendeeList.append([txhash, entryList])

        def getRBFDict():
            return self.rbfDict

        self.root = RBFTreeNode(None, "root", True, getRBFDict)
예제 #4
0
 def setup(self):
    rbfList = self.wallet.getRBFTxOutList()
    
    self.rbfDict = {}
    
    #order outputs by parent hash
    for utxo in rbfList:
       parentHash = utxo.getTxHashStr()
       if not parentHash in self.rbfDict:
          self.rbfDict[parentHash] = []
       
       utxoList = self.rbfDict[parentHash]
       utxoList.append(utxo)
       
    for txhash in self.rbfDict:
       #get outpoints for spender tx
       entryList = self.rbfDict[txhash]
       cppTx = TheBDM.bdv().getTxByHash(txhash)
       
       if cppTx.isInitialized():
          pytx = PyTx().unserialize(cppTx.serialize())
       else:
          continue
       
       for _input in pytx.inputs:
          spentHash = _input.outpoint.txHash
          
          #if this tx redeems an output in our list of RBF tx,
          #link it to the spendee 
          if spentHash in self.rbfDict:
             spendeeList = self.rbfDict[spentHash]
             spendeeList.append([txhash, entryList])
             
    def getRBFDict():
       return self.rbfDict
    
    self.root = RBFTreeNode(None, "root", True, getRBFDict)