Skip to content

Commit

Permalink
fix: The pre-image is now only revealed if the transfer is unlocked.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssantos21 committed Aug 13, 2024
1 parent d80d0e8 commit 57727bd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
3 changes: 2 additions & 1 deletion server/src/database/lightning_latch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ pub async fn get_preimage(pool: &sqlx::PgPool, statechain_id: &str, sender_auth_
lightning_latch \
WHERE statechain_id = $1 \
AND sender_auth_xonly_public_key = $2 \
AND batch_id = $3";
AND batch_id = $3
AND locked = false";

let row = sqlx::query(query)
.bind(statechain_id)
Expand Down
4 changes: 0 additions & 4 deletions server/src/database/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ pub async fn insert_new_signature_data(pool: &sqlx::PgPool, server_pubnonce: &st

pub async fn update_signature_data_challenge(pool: &sqlx::PgPool, server_pub_nonce: &str, challenge: &str, statechain_id: &str) {

println!("server_pub_nonce: {}", server_pub_nonce);
println!("challenge: {}", challenge);
println!("statechain_id: {}", statechain_id);

let query = "\
UPDATE statechain_signature_data \
SET challenge = $1 \
Expand Down
4 changes: 0 additions & 4 deletions server/src/endpoints/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ pub async fn sign_first(statechain_entity: &State<StateChainEntity>, sign_first_
},
};

println!("value: {}", value);

let response: mercurylib::transaction::SignFirstResponsePayload = serde_json::from_str(value.as_str()).expect(&format!("failed to parse: {}", value.as_str()));

let mut server_pubnonce_hex = response.server_pubnonce.clone();
Expand Down Expand Up @@ -153,8 +151,6 @@ pub async fn sign_second (statechain_entity: &State<StateChainEntity>, partial_s
text
},
Err(err) => {
println!("ERROR sig: {}", err);

let response_body = json!({
"error": "Internal Server Error",
"message": err.to_string()
Expand Down

0 comments on commit 57727bd

Please sign in to comment.