Fix error reporting in transaction creation (#1821)
cyan committed
Nov 24, 2024 at 09:49 UTC
cfe78d4e5f9f838ae1be6a7d2d3397dc2771bd4a
1 file changed
+11
-2
cw_monero/lib/api/transaction_history.dart
+11
-2
@@ -192,14 +192,23 @@ String? commitTransaction({required monero.PendingTransaction transactionPointer
192
? monero.PendingTransaction_commitUR(transactionPointer, 120)
193
: monero.PendingTransaction_commit(transactionPointer, filename: '', overwrite: false);
194
195
- final String? error = (() {
195
+ String? error = (() {
196
final status = monero.PendingTransaction_status(transactionPointer.cast());
197
if (status == 0) {
198
return null;
199
}
200
- return monero.Wallet_errorString(wptr!);
200
+ return monero.PendingTransaction_errorString(transactionPointer.cast());
201
})();
202
+ if (error == null) {
203
+ error = (() {
204
+ final status = monero.Wallet_status(wptr!);
205
+ if (status == 0) {
206
+ return null;
207
+ }
208
+ return monero.Wallet_errorString(wptr!);
209
+ })();
210
211
+ }
212
if (error != null) {
213
throw CreationTransactionException(message: error);
214
}