Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Sep 16, 2024
1 parent e277890 commit 5975c9c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 133 deletions.
133 changes: 4 additions & 129 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions core/payment-driver/base/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,16 @@ pub trait PaymentDriver {
let s: [u8; 32] = msg.signature[33..65].try_into().unwrap();
let signature = Signature { v, r, s };

let payload = if msg.canonicalized {
utils::payment_hash_canonicalized(&msg.payment)
let payload = if let Some(payload) = msg.canonical {
match msg.payment.verify_canonical(payload.as_slice()) {
Ok(_) => prepare_signature_hash(&payload),
Err(e) => {
log::info!(
"Signature verification: canonical representation doesn't match struct: {e}"
);
return Ok(false);
}
}
} else {
// Backward compatibility version for older Nodes that don't send canonical
// signed bytes and used Payment debug formatting as representation.
Expand Down
3 changes: 2 additions & 1 deletion core/payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ impl PaymentService {
let config = Arc::new(Config::from_env()?);

let processor = Arc::new(PaymentProcessor::new(db.clone()));
self::service::bind_service(&db, processor.clone(), BindOptions::default(), config);
self::service::bind_service(&db, processor.clone(), config);

processor.process_post_migration_jobs().await?;

tokio::task::spawn(async move {
Expand Down
2 changes: 1 addition & 1 deletion core/payment/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::ops::Sub;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::time::Duration;
use std::time::{Duration, Instant};
use thiserror::Error;
use tokio::sync::{Mutex, RwLock};

Expand Down

0 comments on commit 5975c9c

Please sign in to comment.