ain
ain copied to clipboard
`listunspent` RPC not working as expected when `addresses` and `minimumSumAmount` is given
What happened:
do a query with listunspent with specific address given and upto minimumSumAmount
returned result is empty([])
What you expected to happen:
return utxos for the given address to satisfy minimumSumAmount
How to reproduce it (as minimally and precisely as possible):
What are your environment parameters:
Anything else we need to know?:
looking at the current logic,
at here ->https://github.com/DeFiCh/ain/blob/e63ae12e399b846c5f97dbf3cb1e771f75263255/src/wallet/rpcwallet.cpp#L2975
collects the prevouts upto minimumSumAmount without considering the address filtration. so it returns the results from all utxos in the wallet.
after that at here -> https://github.com/DeFiCh/ain/blob/e63ae12e399b846c5f97dbf3cb1e771f75263255/src/wallet/rpcwallet.cpp#L2988 it runs the address filtration on the 👆 returned results.
Hence the result can become flaky, often resulting in an empty array response.
possible Fix
https://github.com/DeFiCh/ain/blob/e63ae12e399b846c5f97dbf3cb1e771f75263255/src/wallet/coincontrol.h#L49, CCoinControl has matchDestination for a single address. we could use it. But for multiple address matching, needs an update.
@surangap: Thanks for opening an issue, it is currently awaiting triage.
The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.
Details
I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository.