@@ -5,6 +5,7 @@ use crate::util::base58_decode;
5
5
use crate :: web:: data:: RequestToMintBitcreditBillPayload ;
6
6
use crate :: CONFIG ;
7
7
use borsh:: { to_vec, BorshDeserialize } ;
8
+ use log:: error;
8
9
use moksha_core:: primitives:: CheckBitcreditQuoteResponse ;
9
10
use moksha_core:: primitives:: {
10
11
BillKeys , CurrencyUnit , PaymentMethod , PostMintQuoteBitcreditResponse ,
@@ -49,10 +50,15 @@ pub async fn accept_mint_bitcredit(
49
50
req. await . unwrap ( )
50
51
}
51
52
52
- // Usage of tokio::main to spawn a new runtime is necessary here, because Wallet is'nt Send - but
53
+ // Usage of tokio::main to spawn a new runtime is necessary here, because Wallet isn't Send - but
53
54
// this logic will be replaced soon
54
55
#[ tokio:: main]
55
- pub async fn check_bitcredit_quote ( bill_id_hex : & str , node_id : & str , bill_id_base58 : String ) {
56
+ pub async fn check_bitcredit_quote (
57
+ bill_id_hex : & str ,
58
+ node_id : & str ,
59
+ bill_id_base58 : String ,
60
+ quote : BitcreditEbillQuote ,
61
+ ) {
56
62
let dir = PathBuf :: from ( "./data/wallet" . to_string ( ) ) ;
57
63
let db_path = dir. join ( "wallet.db" ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
58
64
let localstore = SqliteLocalStore :: with_path ( db_path. clone ( ) )
@@ -71,7 +77,13 @@ pub async fn check_bitcredit_quote(bill_id_hex: &str, node_id: &str, bill_id_bas
71
77
. check_bitcredit_quote ( & mint_url, bill_id_hex. to_owned ( ) , node_id. to_owned ( ) )
72
78
. await ;
73
79
74
- let quote = result. unwrap ( ) ;
80
+ let quote = result. unwrap_or_else ( |e| {
81
+ error ! ( "{}" , e) ;
82
+ CheckBitcreditQuoteResponse {
83
+ quote : quote. quote_id ,
84
+ amount : quote. sum ,
85
+ }
86
+ } ) ;
75
87
76
88
if !quote. quote . is_empty ( ) {
77
89
add_bitcredit_quote_and_amount_in_quotes_map ( quote. clone ( ) , bill_id_base58) ;
0 commit comments