Commit 9e20435
fix: mint UTXO consolidation sweep entire balance with subtractfee
The previous consolidation logic calculated a target of collateral + 10%
margin + 0.1 DGB, then checked if total balance exceeded that target.
When the margin pushed the target above the available balance (e.g.,
250K collateral + 10% = 275K > 274K available), the consolidation
rejected with "Insufficient funds" even though enough DGB existed.
Fix: sweep the entire wallet balance to self using subtractfeefromamount,
which always succeeds and consolidates all UTXOs into one output. The
fee check now only verifies that collateral + 0.2 DGB fees < total
balance (the actual minimum needed).
Tested: wallet with 500 UTXOs of 500 DGB each (250K total) where the
top 400 UTXOs sum to only 221K — below the 250K collateral requirement.
Previous code threw "Insufficient funds"; fix correctly consolidates
and retries.
Supersedes PR DigiByte-Core#391 consolidation logic.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 6d8cbef commit 9e20435
1 file changed
Lines changed: 14 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
983 | 983 | | |
984 | 984 | | |
985 | 985 | | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
| 986 | + | |
| 987 | + | |
991 | 988 | | |
992 | 989 | | |
993 | 990 | | |
994 | 991 | | |
995 | | - | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
996 | 995 | | |
997 | | - | |
| 996 | + | |
998 | 997 | | |
999 | | - | |
1000 | | - | |
| 998 | + | |
1001 | 999 | | |
1002 | 1000 | | |
1003 | | - | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
| |||
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
| 1014 | + | |
1014 | 1015 | | |
1015 | | - | |
| 1016 | + | |
1016 | 1017 | | |
1017 | 1018 | | |
1018 | 1019 | | |
| |||
1030 | 1031 | | |
1031 | 1032 | | |
1032 | 1033 | | |
1033 | | - | |
1034 | | - | |
| 1034 | + | |
| 1035 | + | |
1035 | 1036 | | |
1036 | 1037 | | |
1037 | 1038 | | |
| |||
0 commit comments