mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
CAKE-333 | fixed commit() method in the pending_bitcoin_transaction.dart; added bitcoin_commit_transaction_exception.dart to the app
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class BitcoinCommitTransactionException implements Exception {
|
||||
@override
|
||||
String toString() => 'Transaction commit is failed.';
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/bitcoin/bitcoin_commit_transaction_exception.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
|
||||
import 'package:cake_wallet/core/pending_transaction.dart';
|
||||
@@ -33,7 +34,13 @@ class PendingBitcoinTransaction with PendingTransaction {
|
||||
|
||||
@override
|
||||
Future<void> commit() async {
|
||||
await electrumClient.broadcastTransaction(transactionRaw: _tx.toHex());
|
||||
final result =
|
||||
await electrumClient.broadcastTransaction(transactionRaw: _tx.toHex());
|
||||
|
||||
if (result.isEmpty) {
|
||||
throw BitcoinCommitTransactionException();
|
||||
}
|
||||
|
||||
_listeners?.forEach((listener) => listener(transactionInfo()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user