def StaticAssetState(assetId): neo = AssetState() neo.AssetId = UInt256.ParseString("0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b") neo.AssetType = 0x00 gas = AssetState() gas.AssetId = UInt256.ParseString("0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7") gas.AssetType = 0x01 if assetId == neo.AssetId: return neo elif assetId == gas.AssetId: return gas else: return None
def test_GetScriptHashesForVerifying_DutyFlag(self): # test a raw tx ms = MemoryStream(binascii.unhexlify(self.rtx)) reader = BinaryReader(ms) tx = Transaction.DeserializeFrom(reader) tx.raw_tx = True # create the mocked asset mock_asset = AssetState() mock_asset.AssetType = 0x80 snapshot = GetBlockchain()._db.createSnapshot() with patch("neo.Core.Helper.Helper.StaticAssetState", return_value=mock_asset): res = tx.GetScriptHashesForVerifying(snapshot) self.assertTrue(type(res), list) self.assertEqual(res[0], Helper.AddrStrToScriptHash("AJQ6FoaSXDFzA6wLnyZ1nFN7SGSN2oNTc3"))