本文整理汇总了Python中test_framework.messages.CTransaction.wit方法的典型用法代码示例。如果您正苦于以下问题:Python CTransaction.wit方法的具体用法?Python CTransaction.wit怎么用?Python CTransaction.wit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_framework.messages.CTransaction
的用法示例。
在下文中一共展示了CTransaction.wit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildDummySegwitNameUpdate
# 需要导入模块: from test_framework.messages import CTransaction [as 别名]
# 或者: from test_framework.messages.CTransaction import wit [as 别名]
def buildDummySegwitNameUpdate (self, name, value, addr):
"""
Builds a transaction that updates the given name to the given value and
address. We assume that the name is at a native segwit script. The witness
of the transaction will be set to two dummy stack elements so that the
program itself is "well-formed" even if it won't execute successfully.
"""
data = self.node.name_show (name)
u = self.findUnspent (Decimal ('0.01'))
ins = [data, u]
outs = {addr: Decimal ('0.01')}
txHex = self.node.createrawtransaction (ins, outs)
nameOp = {"op": "name_update", "name": name, "value": value}
txHex = self.node.namerawtransaction (txHex, 0, nameOp)['hex']
txHex = self.node.signrawtransactionwithwallet (txHex)['hex']
tx = CTransaction ()
tx.deserialize (io.BytesIO (hex_str_to_bytes (txHex)))
tx.wit = CTxWitness ()
tx.wit.vtxinwit.append (CTxInWitness ())
tx.wit.vtxinwit[0].scriptWitness = CScriptWitness ()
tx.wit.vtxinwit[0].scriptWitness.stack = [b"dummy"] * 2
txHex = tx.serialize ().hex ()
return txHex