You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Err(e) => log_error!(self.logger,"Failed to send BOLT12 offer: {:?}. This is part of a unified QR code payment. Falling back to the BOLT11 invoice.", e),
Err(e) => log_error!(self.logger,"Failed to send BOLT11 invoice: {:?}. This is part of a unified QR code payment. Falling back to the on-chain transaction.", e),
156
-
}
157
-
}
158
-
159
-
let amount = match uri_network_checked.amount{
160
-
Some(amount) => amount,
161
-
None => {
162
-
log_error!(self.logger,"No amount specified in the URI. Aborting the payment.");
142
+
let rt = tokio::runtime::Runtime::new().map_err(|e| {
143
+
log_error!(self.logger,"Failed to create Tokio runtime: {}", e);
144
+
Error::InvalidInvoice
145
+
})?;
146
+
147
+
let instructions = rt
148
+
.block_on(PaymentInstructions::parse(
149
+
uri_str,
150
+
self.config.network,
151
+
&DummyHrnResolver,
152
+
false,
153
+
))
154
+
.map_err(|e| {
155
+
log_error!(self.logger,"Failed to parse payment instructions: {:?}", e);
156
+
Error::InvalidUri
157
+
})?;
158
+
159
+
match instructions {
160
+
PaymentInstructions::ConfigurableAmount(_) => {
161
+
log_error!(
162
+
self.logger,
163
+
"Configurable amount payments not supported in this version"
Err(e) => log_error!(self.logger,"Failed to send BOLT12 offer: {:?}. This is part of a unified QR code payment. Falling back to the BOLT11 invoice.", e),
Err(e) => log_error!(self.logger,"Failed to send BOLT11 invoice: {:?}. This is part of a unified QR code payment. Falling back to the on-chain transaction.", e),
181
+
}
182
+
},
183
+
PaymentMethod::OnChain(address) => {
184
+
let amount = match instructions.onchain_payment_amount(){
185
+
Some(amount) => amount,
186
+
None => {
187
+
log_error!(
188
+
self.logger,
189
+
"No amount specified in the URI. Aborting the payment."
190
+
);
191
+
returnErr(Error::InvalidAmount);
192
+
},
193
+
};
194
+
195
+
let txid = self.onchain_payment.send_to_address(
196
+
&address,
197
+
amount.sats().unwrap(),
198
+
None,
199
+
)?;
200
+
returnOk(QrPaymentResult::Onchain{ txid });
201
+
},
202
+
}
203
+
}
204
+
},
205
+
}
172
206
173
-
Ok(QrPaymentResult::Onchain{ txid })
207
+
log_error!(self.logger,"No valid payment method found in the URI.");
0 commit comments