iotaledger / iotaledger/ts-packages
Wallet: Bad input selection with >50 coin objects results in InsufficientCoinBalance in command 0
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 3
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 12
Description
## Bug description
Sending or staking with the coins split over many objects results in this error `InsufficientCoinBalance in command 0`.
Instead of having many inputs, the wallet just tries to split the required amount from a coin object and then fails if it has insufficient funds.
Example tx to send https://explorer.rebased.iota.org/txblock/7iP64PHnpG55YgCSdUZcHN2oedFAugS4ydgo9SG9S88V?deviceId=a68ffc39-4a1e-4362-ad35-9f2c50b9e1e6&network=testnet (I had enough funds, split over 500 objects).
Example tx to stake https://explorer.rebased.iota.org/txblock/59mWXHFh2jvWXLouWAW6z2fTQodys3jcHMjiKtmVLnCK?deviceId=a68ffc39-4a1e-4362-ad35-9f2c50b9e1e6&network=testnet
## Steps To reproduce the bug
1. Split funds into many >50 objects
2. Send a transaction that requires the coins of >50 objects
## Expected behaviour
If there are many objects, the wallet should check how many of them are required to fulfill the needed amount and provide merge them for the gas payment. Why does it only merge 50 currently? 256 is the max_gas_payment_objects, so at least this would be an easy improvement already.
If it's still not enough, it could provide more inputs separated from the gas coin and use the amount from there. Alternatively if that's too complex logic for the wallet, it could at least display an error message that the funds are split over too many objects and that they should be consolidated.
## Actual behaviour
Wallet merges only 50 coin objects for the gas coin and then tries to split the required amount from this gas coin, without checking if it has enough balance
## Errors
`InsufficientCoinBalance in command 0`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.