DefichainPython icon indicating copy to clipboard operation
DefichainPython copied to clipboard

BUG: Governance voting does not work for a Masternode with a changed owner address

Open Kolibri1990 opened this issue 1 year ago • 1 comments

Describe the bug I wanted to vote with a masternode and it didn't work because the owner address is not the one with which the masternode was created. It searches for the masternode with the masternodeId (update masternode tx) of the current owner address at "check_masternode".

In this case, however, it is the txid of the old owner address or the first owner address and not the txid of the input. You even enter the correct masternodeId in the method.

I did a workaround and replaced all masternodeId parameter hardcoded to my correct one.

To Reproduce Steps to reproduce the behavior: Create a Masternode and update the owner address.

Then run the code:

ocean =  Ocean(network="mainnet")
mnemonic = ""
wallet = Wallet(DefichainMainnet)
wallet.from_mnemonic(mnemonic)
account = wallet.get_account(4)
builder = TxBuilder(wallet.from_path(path="m/1129/0/0/4").bech32_address(), account, ocean)
tx = builder.governance.vote('proposalId', 'masternodeId', 'yes')
txid = builder.send_tx(tx)

Expected behavior Build should work with updated owner address.

Here is the error: self.get_dataSource().check_masternode(input.get_txid()): self.ocean.masternodes.get(masternodeId)["data"]

Additional context defichain.exceptions.http.NotFound.NotFound: NotFound(404): {'code': 404, 'type': 'NotFound', 'at': 1708887220659, 'message': 'Unable to find masternode', 'url': '/v0/mainnet/masternodes/txid_from_current_owneraddress'}

Kolibri1990 avatar Feb 25 '24 19:02 Kolibri1990

Thanks @Kolibri1990, I will look into this.

eric-volz avatar Feb 26 '24 10:02 eric-volz