Skip to content

Commit

Permalink
Fix SignatureHint
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed May 3, 2024
1 parent feec1a0 commit 40d978e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions cmd/crates/stellar-ledger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,25 @@ impl<T: Exchange> Stellar for LedgerSigner<T> {
}
})?;

let hint = source_account.to_string().into_bytes()[28..]
.try_into()
.map_err(|e| {
tracing::error!("Error converting source_account to string: {e}");
Error::MissingSignerForAddress {
address: source_account.to_string(),
}
})?;
let sig_bytes = signature.try_into()?;
Ok(DecoratedSignature {
hint: SignatureHint([0u8; 4]), //FIXME
hint: SignatureHint(hint),
signature: Signature(sig_bytes),
})
}

fn sign_txn(
&self,
txn: Transaction,
_source_account: &stellar_strkey::Strkey,
source_account: &stellar_strkey::Strkey,
) -> Result<TransactionEnvelope, Error> {
let signature = block_on(self.sign_transaction(self.hd_path.clone(), txn.clone()))
.map_err(|e| {
Expand All @@ -322,9 +330,17 @@ impl<T: Exchange> Stellar for LedgerSigner<T> {
}
})?;

let hint = source_account.to_string().into_bytes()[28..]
.try_into()
.map_err(|e| {
tracing::error!("Error converting source_account to string: {e}");
Error::MissingSignerForAddress {
address: source_account.to_string(),
}
})?;
let sig_bytes = signature.try_into()?;
let decorated_signature = DecoratedSignature {
hint: SignatureHint([0u8; 4]), //FIXME
hint: SignatureHint(hint),
signature: Signature(sig_bytes),
};

Expand Down

0 comments on commit 40d978e

Please sign in to comment.