Closed AndiyNW closed 1 year ago
Thank you Andiy for submitting the report,
I think i have found your error!
You have probably changed the name of the default wallet of the defichain node in the defi.conf with a line like this: wallet=my_wallet
.
If you change this name the Node
object don't knows the wallet it has to connect to.
And the getmasternode
method wants to check if the given masternode_id
is part of your wallet.
Tell the Node
object which wallet to use by specifying the wallet_name
.
wallet=mywallet
-> "mywallet" is the namenode.wallet.listwallets()
and print it to the consoleNode
object"mywallet" should be replaced by your wallet name
node = Node(user="my username", password="myusernamespasswordfrom-defi.conf", url="127.0.0.1", port=8554, wallet_name="mywallet")
I hope this fixes your error. I would be happy if you share your results with me. :)
If there is only one wallet imported by the defichain node, the Node
object should automatically add this wallet as default wallet for the object .
--> Should be included in the next update.
Hey Eric, that was quick, so thanks for the quick reply and yes, that fixed it. Actually I do have different wallet names, though am surprised, that in some request it's checked and in some not?
I mean, with the actual wallet name put into the node line, it works now, but as written before, the block count or mn1 = node.masternodes.getmasternodeblocks works without a configured wallet_name?
anyway, Dankeschön vielmals 😉👍🏻😎 ciao Andiy
Thanks for the feedback Andiy!
Methods that don't require a wallet in the background like:
Methods that require a wallet in the background like:
ownerIsMine": true
output that the given wallet holds the keys to control the owner address of the masternode.From a defichain node point of view you only have to provide the wallet name if you have more than one wallet imported and a method is called that requires a wallet, then a specific wallet must be specified so that the defichain node knows which wallet to pull the data from.
From the point of view of this libaray you have to import the wallet name even if you have only one wallet imported but it does not have the default name.
That 's what I want to change in the next update. (Selecting the correct wallet name if there is only one wallet imported)
Your welcome :) Gerne doch 😄👍🏻
Hey Eric,
well in a certain way I understand, though strongly, even if I don't own the MN I can query via "getmasternode" and my wallet in the config, which means to me, for some of the calls it wouldn't be needed and in the MN api, even some of the request don't need the wallet either. 🧐
As my programming skills aren't good enough, guess, I just have to live with it 😎
schönes Wochenende noch, ciao Andiy
Describe the bug node.masternodes.getmasternode provides error:
in console:
Traceback (most recent call last): File "/Users/aneuherz/PycharmProjects/anotherdefi/main.py", line 9, in
mn = node.masternodes.getmasternode("97bf91fcf4f3845376aa925d1af145f3e3bb5bb2f85a5bcd648f4a5cf99ac84e")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aneuherz/venv/lib/python3.11/site-packages/defichain/node/modules/masternodes.py", line 74, in getmasternode
return self._node._rpc.call("getmasternode", mn_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aneuherz/venv/lib/python3.11/site-packages/defichain/node/rpc.py", line 46, in call
RPCErrorHandler(response, self._logger) # Check for Exceptions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aneuherz/venv/lib/python3.11/site-packages/defichain/node/RPCErrorHandler.py", line 52, in init
raise InternalServerError(f"{rpc_name}: {msg}")
defichain.exceptions.http.InternalServerError.InternalServerError: InternalServerError(500): RPC_WALLET_NOT_FOUND: Requested wallet does not exist or is not loaded
To Reproduce Steps to reproduce the behavior:
from defichain import Node
node = Node(user="my username", password="myusernamespasswordfrom-defi.conf", url="127.0.0.1", port=8554) blockcount = node.blockchain.getblockcount() # returns block height of the latest block print(blockcount)
mn = node.masternodes.getmasternode("97bf91fcf4f3845376aa925d1af145f3e3bb5bb2f85a5bcd648f4a5cf99ac84e") print(mn)
mn1 = node.masternodes.getmasternodeblocks("97bf91fcf4f3845376aa925d1af145f3e3bb5bb2f85a5bcd648f4a5cf99ac84e") print(mn1)
Expected behavior A clear and concise description of what you expected to happen.
getmasternode 97bf91fcf4f3845376aa925d1af145f3e3bb5bb2f85a5bcd648f4a5cf99ac84e { "97bf91fcf4f3845376aa925d1af145f3e3bb5bb2f85a5bcd648f4a5cf99ac84e": { "ownerAuthAddress": "8MswpkZN4vfrVAPSacHixpARcSKBMrhBkv", "operatorAuthAddress": "8cFm6HKHjY48Zbx1R7TspD9Vq36UpJkWKh", "rewardAddress": "", "creationHeight": 2568955, "resignHeight": -1, "resignTx": "0000000000000000000000000000000000000000000000000000000000000000", "collateralTx": "0000000000000000000000000000000000000000000000000000000000000000", "state": "ENABLED", "mintedBlocks": 1, "ownerIsMine": true, "operatorIsMine": false, "localMasternode": false, "targetMultipliers": [ 49, 1 ] } }
Additional context Add any other context about the problem here.
other stuff, like in my code snippet you can see,
mn1 = node.masternodes.getmasternodeblocks
works fine.....