Fix error reporting in transaction creation (#1821)
Some checks failed
Cache Dependencies / test (push) Has been cancelled

This commit is contained in:
cyan 2024-11-24 09:49:42 +01:00 committed by GitHub
parent 29b659e748
commit cfe78d4e5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,14 +192,23 @@ String? commitTransaction({required monero.PendingTransaction transactionPointer
? monero.PendingTransaction_commitUR(transactionPointer, 120)
: monero.PendingTransaction_commit(transactionPointer, filename: '', overwrite: false);
final String? error = (() {
String? error = (() {
final status = monero.PendingTransaction_status(transactionPointer.cast());
if (status == 0) {
return null;
}
return monero.Wallet_errorString(wptr!);
return monero.PendingTransaction_errorString(transactionPointer.cast());
})();
if (error == null) {
error = (() {
final status = monero.Wallet_status(wptr!);
if (status == 0) {
return null;
}
return monero.Wallet_errorString(wptr!);
})();
}
if (error != null) {
throw CreationTransactionException(message: error);
}