Hey @Support,
For a while, I couldn’t consolidate one of my accounts. I was getting an error like “something is not quite right”. My wallet was getting slower. Finally, I’ve found the bug. The bug is in both the client side and server side. If the value of the first 30 UTXOs of an account is zero, the total UTXO value becomes 0. At that point, the bug starts. Consolidate feature of the app does not allow zero total and becomes unsuccessful. Using go-incognito-sdk, I canceled those zero checks at the client side but this time, the server side (full node) raises an error since it has some checks too. Modifying the server’s code and syncing the chain would be costly for me. So, I applied the workaround below in calculateOutputCoinsByMinValue()
of https://github.com/incognitochain/go-incognito-sdk/blob/master/rpcserver/rpcservice/defragmentservice.go file (please follow the pass
variable) and this new code does not allow zero total. However, as you may guess, it does not solve the problem if all remaining UTXO values are zero. FYI.
func (txService TxService) calculateOutputCoinsByMinValue(outCoins []*privacy.OutputCoin, maxVal uint64, maxDefragmentQuantityTemp int) ([]*privacy.OutputCoin, uint64) {
outCoinsTmp := make([]*privacy.OutputCoin, 0)
amount := uint64(0)
// Abduraman: pass variable newly introduced
pass := true
for _, outCoin := range outCoins {
if outCoin.CoinDetails.GetValue() <= maxVal && (pass || outCoin.CoinDetails.GetValue() > 0) {
fmt.Println(outCoin.CoinDetails.GetValue())
outCoinsTmp = append(outCoinsTmp, outCoin)
amount += outCoin.CoinDetails.GetValue()
if len(outCoinsTmp) == maxDefragmentQuantityTemp - 1 && amount == 0 {
pass = false
}
if len(outCoinsTmp) >= maxDefragmentQuantityTemp {
break
}
}
}
return outCoinsTmp, amount
}