def test_witness_update(self): self.op = operations.Witness_update( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "prefix": "TEST", "witness": "1.6.63", "witness_account": "1.2.212", "new_url": "https://example.com", "new_signing_key": "BTS5vfCLKyXYb44znYjbrJXCyvvx3SuifhmvemnQsdbf61EtoR36z", }) self.cm = ("f68585abf4dce7c8045701150000000000000000003fd401011" "368747470733a2f2f6578616d706c652e636f6d0102889f66e3" "584423e86b615e3b07593ebec4b1ac0e08ad4a3748f0726dae7" "c874f0001205628a49ef823ab54f4b4c56304f5ac57bdc3768c" "62ac630a92de9858f5d90fad01c43bdc406293edad734d53dca" "a1c96546a50e3ec96d07cf1224ed329177af5") self.doit()
def test_witness_update(self): op = operations.Witness_update( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "prefix": "TEST", "witness": "1.6.63", "witness_account": "1.2.212", "new_url": "https://example.com", "new_signing_key": "BTS5vfCLKyXYb44znYjbrJXCyvvx3SuifhmvemnQsdbf61EtoR36z" }) ops = [Operation(op)] tx = Signed_Transaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif], chain=prefix) tx.verify([PrivateKey(wif).pubkey], "BTS") txWire = hexlify(bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c8045701150000000000000000003fd401011" "368747470733a2f2f6578616d706c652e636f6d0102889f66e3" "584423e86b615e3b07593ebec4b1ac0e08ad4a3748f0726dae7" "c874f0001205628a49ef823ab54f4b4c56304f5ac57bdc3768c" "62ac630a92de9858f5d90fad01c43bdc406293edad734d53dca" "a1c96546a50e3ec96d07cf1224ed329177af5") self.assertEqual(compare[:-130], txWire[:-130])
def updatewitness(account, reward_percent): GRAPHENE_1_PERCENT = 100 witness = Witness(account) account = witness.account op = operations.Witness_update( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "prefix": blockchain.prefix, "witness": witness["id"], "witness_account": account["id"], "block_producer_reward_pct": int(reward_percent) * GRAPHENE_1_PERCENT }) return blockchain.finalizeOp(op, account["name"], "active")
def update_witness(self, witness_identifier, url=None, key=None): """ Upgrade a witness account :param str witness_identifier: Identifier for the witness :param str url: New URL for the witness :param str key: Public Key for the signing """ witness = Witness(witness_identifier) account = witness.account op = operations.Witness_update( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "prefix": self.rpc.chain_params["prefix"], "witness": witness["id"], "witness_account": account["id"], "new_url": url, "new_signing_key": key, }) return self.finalizeOp(op, account["name"], "active")