本文整理汇总了Python中coinpy.model.protocol.structures.uint256.Uint256.from_hexstr方法的典型用法代码示例。如果您正苦于以下问题:Python Uint256.from_hexstr方法的具体用法?Python Uint256.from_hexstr怎么用?Python Uint256.from_hexstr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coinpy.model.protocol.structures.uint256.Uint256
的用法示例。
在下文中一共展示了Uint256.from_hexstr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serialize_inv_message
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_serialize_inv_message(self):
inv_message = InvMessage([Invitem(INV_TX, Uint256.from_hexstr("f6eea3dd4f6536350344a535e37a4178170bba18b871a424d696e196d4d3b555")),
Invitem(INV_BLOCK, Uint256.from_hexstr("0000000040a24e14497879bdd67db948cf30edc5d0a5833e8cb2736582157b49"))])
serialized_msg = MessageSerializer(MAIN).serialize(inv_message)
self.assertEquals(hexstr(serialized_msg), "f9beb4d9696e76000000000000000000490000008be920f5020100000055b5d3d496e196d624a471b818ba0b1778417ae335a544033536654fdda3eef602000000497b15826573b28c3e83a5d0c5ed30cf48b97dd6bd797849144ea24000000000")
serialized_msg = MessageSerializer(TESTNET).serialize(inv_message)
self.assertEquals(hexstr(serialized_msg), "fabfb5da696e76000000000000000000490000008be920f5020100000055b5d3d496e196d624a471b818ba0b1778417ae335a544033536654fdda3eef602000000497b15826573b28c3e83a5d0c5ed30cf48b97dd6bd797849144ea24000000000")
示例2: test_deserialize_getdata_message
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_deserialize_getdata_message(self):
serialized_getdata = decodehexstr("030100000098a23359c17ca2678e2039c8ff9081b18c4913749c9a081ac3f62958f09fa4720100000055b5d3d496e196d624a471b818ba0b1778417ae335a544033536654fdda3eef602000000497b15826573b28c3e83a5d0c5ed30cf48b97dd6bd797849144ea24000000000")
getdata_msg, _ = GetdataMessageSerializer().deserialize(serialized_getdata)
expected_msg = GetdataMessage([Invitem(INV_TX, Uint256.from_hexstr("72a49ff05829f6c31a089a9c7413498cb18190ffc839208e67a27cc15933a298")),
Invitem(INV_TX, Uint256.from_hexstr("f6eea3dd4f6536350344a535e37a4178170bba18b871a424d696e196d4d3b555")),
Invitem(INV_BLOCK, Uint256.from_hexstr("0000000040a24e14497879bdd67db948cf30edc5d0a5833e8cb2736582157b49"))])
self.assertEquals(getdata_msg, expected_msg)
示例3: test_sign_transaction
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_sign_transaction(self):
tx = Tx(version=1,
in_list=[TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("d2a42ebcb98b598ddcb6d430ce9061dba76804a97f7c1413dd3faef744f909a8"),index=0),
script=Script(instructions=[]),
sequence=4294967295),TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("2be8e319be1d15c1ba54708bdd7969b638e7e6fa2154819136e363ea6d33664a"),index=1),
script=Script(instructions=[]),
sequence=4294967295)],
out_list=[TxOut(value=3315075843,
script=Script(instructions=[Instruction(OP_DUP),Instruction(OP_HASH160),Instruction(20, decodehexstr("297c5a2ee31a1ab721115722d83f8654ca21d5df")),Instruction(OP_EQUALVERIFY),Instruction(OP_CHECKSIG)])),TxOut(value=2971972133,
script=Script(instructions=[Instruction(OP_DUP),Instruction(OP_HASH160),Instruction(20, decodehexstr("7d5feab86e31e8fc99d8e735d56226de9043e5fc")),Instruction(OP_EQUALVERIFY),Instruction(OP_CHECKSIG)])),TxOut(value=1046301823,
script=Script(instructions=[Instruction(OP_DUP),Instruction(OP_HASH160),Instruction(20, decodehexstr("fd91232a2fa0c389fa0188efde26c8a6165f4c50")),Instruction(OP_EQUALVERIFY),Instruction(OP_CHECKSIG)]))],
locktime=0)
outscript0 = Script(instructions=[Instruction(33, decodehexstr("03409fe679bdff9e801692c999b86d0c47b62dc02cdd10591ee70ca8056cd05023")),Instruction(OP_CHECKSIG)])
outscript1 = Script(instructions=[Instruction(OP_DUP),Instruction(OP_HASH160),Instruction(20, decodehexstr("5fb7fdb3d1ab0f3fec90b38417cca8ab736b10c6")),Instruction(OP_EQUALVERIFY),Instruction(OP_CHECKSIG)])
# Sign TX_PUBKEY
sign_transaction(tx,
[TxOut(None, outscript0), TxOut(None, outscript1)],
[decodehexstr("f006b27418527b1c400bbc434a3f22ee57c376bd4819cfe2a1162682788ae714"),
decodehexstr("c693115901c2840badd1e404706a4866a90d3afa16a542c1a3d0de9aad0875fe")])
vm = TxValidationVM()
valid, reason = vm.validate(tx, 0, outscript0, tx.in_list[0].script)
if not valid:
raise Exception(reason)
valid, reason = vm.validate(tx, 1, outscript1, tx.in_list[1].script)
if not valid:
raise Exception(reason)
示例4: test_invitem_serialize
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_invitem_serialize(self):
blockitem = Invitem(INV_BLOCK, Uint256.from_hexstr("00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008"))
txitem = Invitem(INV_TX, Uint256.from_hexstr("84eb3cf3a391a0a0b70e05a3a54d8385f7dcb3809aaf274d392622205b27f288"))
self.assertEquals(hexstr(InvitemSerializer().serialize(blockitem)),
"0200000008b067b31dc139ee8e7a76a4f2cfcca477c4c06e1ef89f4ae308951907000000")
self.assertEquals(hexstr(InvitemSerializer().serialize(txitem)),
"0100000088f2275b202226394d27af9a80b3dcf785834da5a3050eb7a0a091a3f33ceb84")
示例5: test_WalletFile_1
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_WalletFile_1(self):
io = IoHandle.using_stringio()
wallet = WalletFile.new(io)
wallet.start_tx()
wallet.outpoints[1]= OutpointIndex(12,
Uint256.from_hexstr("2af4cc9ec3358354345c91694031a1fcdbe9a9064197521814e8a20fe018eb5f"),
3,
OutpointIndex.PUBKEY_HASH,
4,
PubKeyOutpoint(PublicKey.from_hexstr("022af4cc9ec3358354345c91691031a1fcdbe9a9064197521814e8a20fe018eb5f"),
is_pubkey_hash=True))
wallet.end_tx()
wallet.commit()
wallet.start_tx()
wallet.outpoints[1] = OutpointIndex(12,
Uint256.from_hexstr("2af4cc9ec3358354345c91694031a1fcdbe9a9064197521814e8a20fe018eb5f"),
3,
OutpointIndex.PUBKEY_HASH,
4,
PubKeyOutpoint(PublicKey.from_hexstr("022af4cc9ec3358354345c91691031a1fcdbe9a9064197521814e8a20fe018eb5f"),
is_pubkey_hash=True))
wallet.end_tx()
wallet.commit()
#with open(r"c:\local\tmp\wallet-test.wlt", "wb") as wlt:
# wlt.write(io.iohandle.getvalue())
io.seek(0, SEEK_SET)
wallet2 = WalletFile.load(io, len(io.iohandle.getvalue()))
print wallet2.fileheader
print wallet2.outpoints
示例6: test_get_block_handle
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_get_block_handle(self):
with self.assertRaises(BlockNotFound):
self.database1.get_block_handle(Uint256.from_hexstr("041f9c93fece90e2e1f729bb9c2b04ba59432592f8ebdc7d117146c74f7c833a"))
handle1 = self.database1.get_block_handle(Uint256.from_hexstr("001f9c93fece90e2e1f729bb9c2b04ba59432592f8ebdc7d117146c74f7c833a"))
self.assertEquals(handle1.get_height(), 4)
self.assertEquals(handle1.get_hash(), Uint256.from_hexstr("001f9c93fece90e2e1f729bb9c2b04ba59432592f8ebdc7d117146c74f7c833a"))
assert isinstance(handle1.get_block(), Block)
assert isinstance(handle1.get_blockheader(), BlockHeader)
示例7: test_blocklocator_deserialize
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_blocklocator_deserialize(self):
loc, cursor = BlockLocatorSerializer().deserialize(decodehexstr("0100000005a329e1166037b2ea0cfbef5060c011c1cbbd37ad047a47b62d3dae020000000070bdb41302a622800ddfb2b3ebdd937fdca812ec8a7ab90ef250410700000000398052b24b2cc45ef953222e23880d25c3df95a913e72e9b015b34250000000066739a04b15f117929b581f6fe0ba2906bc4323829400f949086bb7d0000000008b067b31dc139ee8e7a76a4f2cfcca477c4c06e1ef89f4ae308951907000000"))
self.assertEquals(loc, BlockLocator(version=1,
blockhashlist=[Uint256.from_hexstr("0000000002ae3d2db6477a04ad37bdcbc111c06050effb0ceab2376016e129a3"),
Uint256.from_hexstr("00000000074150f20eb97a8aec12a8dc7f93ddebb3b2df0d8022a60213b4bd70"),
Uint256.from_hexstr("0000000025345b019b2ee713a995dfc3250d88232e2253f95ec42c4bb2528039"),
Uint256.from_hexstr("000000007dbb8690940f40293832c46b90a20bfef681b52979115fb1049a7366"),
Uint256.from_hexstr("00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008")]))
示例8: test_blockheader_serialize
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_blockheader_serialize(self):
h = BlockHeader(version=1,
hash_prev=Uint256.from_hexstr("1e4baab89f3a3251818c31bc87f6a33b4a5a88ef76673e2cc77ab2127b7afded"), #hash_prev
hash_merkle=Uint256.from_hexstr("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"), #merkle
time=1237006505,
bits=486605799,
nonce=2083236893)
self.assertEquals(hexstr(BlockheaderSerializer().serialize(h)), "01000000edfd7a7b12b27ac72c3e6776ef885a4a3ba3f687bc318c8151323a9fb8aa4b1e3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4aa938bb49e703011d1dac2b7c")
示例9: test_mine_genesis_block
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_mine_genesis_block(self):
""" Mine the unitnet GENESIS block """
time_source = MockTimeSource(time=1356446436)
miner = BitcoinMiner()
block, template = miner.mine_block(hash_prev=Uint256.from_hexstr("0000000000000000000000000000000000000000000000000000000000000000"),
block_height=0,
time_source=time_source,
difficulty_bits=524287999,
transactions=[],
coinbase_txout_list=[TxOut(5000000000, Script([push_data_instruction(decodehexstr("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f")),Instruction(OP_CHECKSIG)]))],
coinbase_flags=["/P2SH/", "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"])
self.assertEquals(block.blockheader.nonce, 1260)
self.assertEquals(block.blockheader.hash_merkle, Uint256.from_hexstr("cf7ac9a3b387cf5e9fc14e03e2a5bbfc16d1ba00d2af6c96869ab4da949bd240"))
self.assertEquals(hash_block(block), Uint256.from_hexstr("003ee3cf880906caa5662f10d4b4fb1c86c1853230dee8a7b8a62f434c73da5f"))
示例10: test_txin_serialize
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_txin_serialize(self):
txin = TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("17c5cb687ba453ab65e12cdc0d8721c70ab4678665eb200c50cb9f1e3207090e"), index=0),
script=Script([Instruction(72, decodehexstr("3045022100ab2dc8932ca1d26f4cdac1feae09020a60ccc4d17b14e5fc5b21f3ab8c3a9cee022040a7208c172d19a19902280d66201c7fe2c3d8b2df7e23cc4e5b70fd52ecba2c01")),
Instruction(65, decodehexstr("04b77dd1f3a21cb3d067a7e76982a609d7310f8692f5d61346f3225323c425604a0c12862755335c49e392673106adfc5dfdee1e4d367f10353e8911fac687db3e"))]),
sequence=TxIn.NSEQUENCE_FINAL)
self.assertEquals(hexstr(TxinSerializer().serialize(txin)),
"0e0907321e9fcb500c20eb658667b40ac721870ddc2ce165ab53a47b68cbc517000000008b483045022100ab2dc8932ca1d26f4cdac1feae09020a60ccc4d17b14e5fc5b21f3ab8c3a9cee022040a7208c172d19a19902280d66201c7fe2c3d8b2df7e23cc4e5b70fd52ecba2c014104b77dd1f3a21cb3d067a7e76982a609d7310f8692f5d61346f3225323c425604a0c12862755335c49e392673106adfc5dfdee1e4d367f10353e8911fac687db3effffffff")
示例11: test_serialize_getblocks_message
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_serialize_getblocks_message(self):
getblocks_msg = GetblocksMessage(BlockLocator(32200,
[Uint256.from_hexstr("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")]),
Uint256.zero())
serialized_msg = GetblocksMessageSerializer().serialize(getblocks_msg)
self.assertEquals(hexstr(serialized_msg), "c87d0000016fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000000000000000000000000000000000000000000000000000000000000000000")
示例12: test_deserialize_tx_message
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_deserialize_tx_message(self):
# TX 1 from block 398 on testnet 3
serialized_tx_message = decodehexstr("010000000328ce10c7189026866bcfc1d06b278981ddf21ec0e364e28e294365b5c328cd43000000006c493046022100b918951cc55fbb285168004de7eab21e702e89dc43c167ba0fc1b09273e29cf5022100f95c24b6c740e2306a45bea1e7a0c8f2032c9d4da4d8d1cc6b5c4166d1fabfe50121033b2dd6fe53611ef3d112b7098a8999f48bf27c7bf94bd045439d87a9ec11fca3fffffffffc4f1ed498c5f31fe90b10389f12566a3350a5080db1dba1f01f8834e5813ca900000000484730440220161ee27efad282e8c984051418fcc2bca6854f3f5d4e24031b950bcd7853943a02202b5566c72aeaff2295db82c79d52d88dbe9450e01c6c951d5d0148c290f6cbbe01fffffffffc5eecfa90d46aeeda36bb1a2f2da61e4f9be81253033ae55625d00acb13ef35000000004a493046022100f7d996bc39ef00b217014ee3e7f8b49ed714fcce2fe970a2ada2b9a87a741c2d022100c55a6089c2b23ec87c5063513c6c8abfc14c913f8ab69cf4ebed6a58c220946901ffffffff0340f1f23a000000001976a914f069756ffd9d331119e5430268437aed14210afb88ac00f2052a0100000017a914290bba32a49315789a030bb40b0047f8fb90ff668700f2052a0100000017a9141d9ca71efa36d814424ea6ca1437e67287aebe348700000000")
tx_message, _ = TxMessageSerializer().deserialize(serialized_tx_message)
expected_message = TxMessage(Tx(version=1,
in_list=[TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("43cd28c3b56543298ee264e3c01ef2dd8189276bd0c1cf6b86269018c710ce28"),index=0),
script=Script(instructions=[Instruction(73, decodehexstr("3046022100b918951cc55fbb285168004de7eab21e702e89dc43c167ba0fc1b09273e29cf5022100f95c24b6c740e2306a45bea1e7a0c8f2032c9d4da4d8d1cc6b5c4166d1fabfe501")),Instruction(33, decodehexstr("033b2dd6fe53611ef3d112b7098a8999f48bf27c7bf94bd045439d87a9ec11fca3"))]),
sequence=4294967295),TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("a93c81e534881ff0a1dbb10d08a550336a56129f38100be91ff3c598d41e4ffc"),index=0),
script=Script(instructions=[Instruction(71, decodehexstr("30440220161ee27efad282e8c984051418fcc2bca6854f3f5d4e24031b950bcd7853943a02202b5566c72aeaff2295db82c79d52d88dbe9450e01c6c951d5d0148c290f6cbbe01"))]),
sequence=4294967295),TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("35ef13cb0ad02556e53a035312e89b4f1ea62d2f1abb36daee6ad490faec5efc"),index=0),
script=Script(instructions=[Instruction(73, decodehexstr("3046022100f7d996bc39ef00b217014ee3e7f8b49ed714fcce2fe970a2ada2b9a87a741c2d022100c55a6089c2b23ec87c5063513c6c8abfc14c913f8ab69cf4ebed6a58c220946901"))]),
sequence=4294967295)],
out_list=[TxOut(value=989000000,
script=Script(instructions=[Instruction(OP_DUP),Instruction(OP_HASH160),Instruction(20, decodehexstr("f069756ffd9d331119e5430268437aed14210afb")),Instruction(OP_EQUALVERIFY),Instruction(OP_CHECKSIG)])),TxOut(value=5000000000,
script=Script(instructions=[Instruction(OP_HASH160),Instruction(20, decodehexstr("290bba32a49315789a030bb40b0047f8fb90ff66")),Instruction(OP_EQUAL)])),TxOut(value=5000000000,
script=Script(instructions=[Instruction(OP_HASH160),Instruction(20, decodehexstr("1d9ca71efa36d814424ea6ca1437e67287aebe34")),Instruction(OP_EQUAL)]))],
locktime=0))
self.assertEquals(tx_message, expected_message)
示例13: test_transaction_handle
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_transaction_handle(self):
with self.assertRaises(TransactionNotFound):
self.database1.get_transaction_handle(Uint256.from_hexstr("07c17eafb870acf0fece060b814ff71fd36a7df0f0a3a7e359c2c61b3b34c3e1"))
handle1 = self.database1.get_transaction_handle(Uint256.from_hexstr("cebbc8d7d3550ca6df92eba4f41b93dc55f35b8199bb14dc3d0a95f9bd0e2dbd"))
assert isinstance(handle1.get_transaction(), Tx)
self.assertEquals(str(handle1.get_block_hash()), "001f9c93fece90e2e1f729bb9c2b04ba59432592f8ebdc7d117146c74f7c833a")
self.assertEquals(handle1.output_count(), 7)
self.assertEquals(handle1.is_output_spent(0), False)
self.assertEquals(handle1.is_output_spent(2), True)
self.assertEquals(str(handle1.get_spending_transaction_hash(2)),
"53bb1c14b4c6156d7352ee471fb7697736f4696accf5392e0f1830e38143f667")
handle1.mark_unspent(2)
self.assertEquals(handle1.is_output_spent(2), False)
handle1.mark_spent(0, Uint256.from_hexstr("13bb1c14b4c6156d7352ee471fb7697736f4696accf5392e0f1830e38143f667"))
self.assertEquals(handle1.is_output_spent(2), False)
self.assertEquals(handle1.is_output_spent(0), True)
self.assertEquals(str(handle1.get_spending_transaction_hash(0)),
"13bb1c14b4c6156d7352ee471fb7697736f4696accf5392e0f1830e38143f667")
示例14: test_deserialize_block_message
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_deserialize_block_message(self):
#block 22 on testnet 3
serialized_block_msg= decodehexstr("0100000073379e3ff3dffd006e0090e52ac571a9a309490a23e64d15f8af291a0000000051f1c5b2b7c8f980e7715b4d3ce0180f99c44a16fc9c00ede2f5984b8d7cc22d16ed494dffff001d0082467f0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f0416ed494d02fa00062f503253482fffffffff0100f2052a01000000232103b787920594cb47fbfccee915befae40ac2e2b295224460eee075ad0ada4c0c54ac00000000")
block_msg, _ = BlockMessageSerializer().deserialize(serialized_block_msg)
expected_block_msg = BlockMessage(Block(blockheader=BlockHeader(version=1,
hash_prev=Uint256.from_hexstr("000000001a29aff8154de6230a4909a3a971c52ae590006e00fddff33f9e3773"),
hash_merkle=Uint256.from_hexstr("2dc27c8d4b98f5e2ed009cfc164ac4990f18e03c4d5b71e780f9c8b7b2c5f151"),
time=1296690454,
bits=486604799,
nonce=2135327232),
transactions=[Tx(version=1,
in_list=[TxIn(previous_output=Outpoint(hash=Uint256.from_hexstr("0000000000000000000000000000000000000000000000000000000000000000"),index=4294967295),
script=Script(instructions=[Instruction(4, decodehexstr("16ed494d")),Instruction(2, decodehexstr("fa00")),Instruction(6, decodehexstr("2f503253482f"))]),
sequence=4294967295)],
out_list=[TxOut(value=5000000000,
script=Script(instructions=[Instruction(33, decodehexstr("03b787920594cb47fbfccee915befae40ac2e2b295224460eee075ad0ada4c0c54")),Instruction(OP_CHECKSIG)]))],
locktime=0)]))
self.assertEquals(block_msg, expected_block_msg)
示例15: test_serialize_outpoint_index
# 需要导入模块: from coinpy.model.protocol.structures.uint256 import Uint256 [as 别名]
# 或者: from coinpy.model.protocol.structures.uint256.Uint256 import from_hexstr [as 别名]
def test_serialize_outpoint_index(self):
outpoint = OutpointIndex(12,
Uint256.from_hexstr("2af4cc9ec3358354345c91694031a1fcdbe9a9064197521814e8a20fe018eb5f"),
3,
OutpointIndex.PUBKEY_HASH,
4,
PubKeyOutpoint(PublicKey.from_hexstr("022af4cc9ec3358354345c91691031a1fcdbe9a9064197521814e8a20fe018eb5f"),
is_pubkey_hash=True))
serialized = OutpointIndexSerializer.serialize(outpoint)
self.assertEquals(hexstr(serialized),
"0000000c2af4cc9ec3358354345c91694031a1fcdbe9a9064197521814e8a20fe018eb5f030200000004022af4cc9ec3358354345c91691031a1fcdbe9a9064197521814e8a20fe018eb5f")