本文整理汇总了Python中armoryengine.BDM.TheBDM.getTxByHash方法的典型用法代码示例。如果您正苦于以下问题:Python TheBDM.getTxByHash方法的具体用法?Python TheBDM.getTxByHash怎么用?Python TheBDM.getTxByHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类armoryengine.BDM.TheBDM
的用法示例。
在下文中一共展示了TheBDM.getTxByHash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: searchItem
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getTxByHash [as 别名]
def searchItem():
searchString = str(self.searchEntry.text())
if len(searchString) > 0:
likelyDataType = isLikelyDataType(searchString)
for wltID, wlt in self.main.walletMap.iteritems():
if wlt.hasAddr(searchString):
searchHash = searchString if likelyDataType == DATATYPE.Hex \
else addrStr_to_hash160(searchString)[1]
dialog = DlgAddressInfo(wlt, searchHash, main=self.main)
dialog.exec_()
break
if likelyDataType == DATATYPE.Hex:
walletLedger = wlt.cppWallet.getTxLedger()
txHashToFind = hex_to_binary(searchString, endOut=BIGENDIAN)
txFound = False
for entry in walletLedger:
if entry.getTxHash() == txHashToFind:
cppTx = TheBDM.getTxByHash(txHashToFind)
serializedCppTx = cppTx.serialize()
pytx = PyTx().unserialize(serializedCppTx)
DlgDispTxInfo(pytx, wlt, self.main, self.main).exec_()
txFound = True
break
if txFound:
break
示例2: sendDust
# 需要导入模块: from armoryengine.BDM import TheBDM [as 别名]
# 或者: from armoryengine.BDM.TheBDM import getTxByHash [as 别名]
def sendDust():
try:
utxiList = []
for utxo in self.dustTableModel.dustTxOutlist:
# The PyCreateAndSignTx method require PyTx and PyBtcAddress objects
rawTx = TheBDM.getTxByHash(utxo.getTxHash()).serialize()
a160 = CheckHash160(utxo.getRecipientScrAddr())
for pyAddr in self.dustTableModel.wlt.addrMap.values():
if a160 == pyAddr.getAddr160():
pubKey = pyAddr.binPublicKey65.toBinStr()
txoIdx = utxo.getTxOutIndex()
utxiList.append(UnsignedTxInput(rawTx, txoIdx, None, pubKey))
break
# Make copies, destroy them in the finally clause
privKeyMap = {}
for addrObj in self.dustTableModel.wlt.addrMap.values():
scrAddr = SCRADDR_P2PKH_BYTE + addrObj.getAddr160()
if self.dustTableModel.wlt.useEncryption and self.dustTableModel.wlt.isLocked:
# Target wallet is encrypted...
unlockdlg = DlgUnlockWallet(self.dustTableModel.wlt,
self.main, self.main, 'Unlock Wallet to Import')
if not unlockdlg.exec_():
QMessageBox.critical(self, 'Wallet is Locked', \
'Cannot send dust without unlocking the wallet!', \
QMessageBox.Ok)
return
privKeyMap[scrAddr] = addrObj.binPrivKey32_Plain.copy()
signedTx = PyCreateAndSignTx(utxiList,
[],
privKeyMap, SIGHASH_NONE|SIGHASH_ANYONECANPAY )
print "-------------"
print binary_to_hex(signedTx.serialize())
# sock = socket.create_connection(('dust-b-gone.bitcoin.petertodd.org',80))
# sock.send(signedTx.serialize())
# sock.send(b'\n')
# sock.close()
except socket.error as err:
QMessageBox.critical(self.main, tr('Negative Value'), tr("""
Failed to connect to dust-b-gone server: %s""" % err.strerror), QMessageBox.Ok)
except NegativeValueError:
QMessageBox.critical(self.main, tr('Negative Value'), tr("""
You must enter a positive value of at least 0.0000 0001
and less than %s for the dust limit.""" % MAX_DUST_LIMIT_STR), QMessageBox.Ok)
except TooMuchPrecisionError:
QMessageBox.critical(self.main.main, tr('Too much precision'), tr("""
Bitcoins can only be specified down to 8 decimal places.
The smallest unit of a Groestlcoin is 0.0000 0001 GRS.
Please enter a dust limit of at least 0.0000 0001 and less than %s.""" % MAX_DUST_LIMIT_STR), QMessageBox.Ok)
finally:
for scraddr in privKeyMap:
privKeyMap[scraddr].destroy()