Skip to content

Commit

Permalink
Monero: fix signature hash for V1 txs (#598)
Browse files Browse the repository at this point in the history
* fix signature hash for V1 txs

* fix CI
  • Loading branch information
Boog900 authored Aug 24, 2024
1 parent a2df54d commit 394db44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion networks/monero/src/tests/vectors/transactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
{
"id": "55ba10662968c57fc8fed2c82a99d6fd9516730c245f58e9e87bb9a35378014a",
"hex": "01000302b0f9cf0e0100e53d3d97d11974ccf49d23513b9465bc139bda14b8207288e41557707e59c2dc02c08092de06010133e69f524f1989738827c9fb9087d45d7b6865645453f620189939d926735b3902b0b2c4f62201001d680e360c156c7cc952b0c4fc39a39c95a766423109766ae3dcf0c5cf8abf9e06a0f736026bcac41f5468fd1bcf8994e1a4282aecb420005ec294324faec5c6f46806614780c8afa025027998ef0ac319d96b224fa3c33fe12677ef06f4aed80916f28e3f7a684a1c89d78094ebdc03028e0004b98f7c622f1d0364a2d0270c40e6606793bd948a41af9287016d264d7580ade20402f911ad66eabcd8112e90130d7594cb8fc413431da9b5b004c8651d100a2ac8fb8084af5f029caa24c41b1b4938e7e066a7e59592fdc3c832e2516048e57af5d8acca9bef0ac0b80202e99b6a2e000f03f73c1966e16875945ffad20b1895efa17202c6e240191b01e421011da6ff966df43bd44f513aaafa260c54e2ad31469664fa7b0a44fed4ead9a483056cd88c350b340289694ad525f1316367ed16673dc23911e624e6bac4a48b032a623d09ce5bd85a839534de4fbbfb72da2a6779a66f775c16379e8abd122401a5a19c47bb8ecd0c7aa9610513b611602d246f3b07fa19512dc8fde7b180c704694b2d75abbaa2907cda52f888f18ded34308dd1b40f1fb33a01340a1ddc5f07ce19ab4357c52764600861d2d331cfed5972fff42dac64583d617fa4ee27a509a8c29ff77fc71bc7cd106ce54cd3020d1c18c6c794aaa93cb32cd4ff55d82b04",
"signature_hash": "55ba10662968c57fc8fed2c82a99d6fd9516730c245f58e9e87bb9a35378014a",
"signature_hash": "1ad261b4c8f35b8861c4f3a78b240a85e44be6a8ac49acd1e50de4680adf7fac",
"tx": {
"version": 1,
"unlock_time": 0,
Expand Down
4 changes: 2 additions & 2 deletions networks/monero/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,11 @@ impl Transaction<NotPruned> {
/// This returns None if the transaction is without signatures.
pub fn signature_hash(&self) -> Option<[u8; 32]> {
Some(match self {
Transaction::V1 { prefix, signatures } => {
Transaction::V1 { prefix, .. } => {
if (prefix.inputs.len() == 1) && matches!(prefix.inputs[0], Input::Gen(_)) {
None?;
}
self.hash_with_prunable_hash(PrunableHash::V1(signatures))
self.hash_with_prunable_hash(PrunableHash::V1(&[]))
}
Transaction::V2 { proofs, .. } => self.hash_with_prunable_hash({
let Some(proofs) = proofs else { None? };
Expand Down

0 comments on commit 394db44

Please sign in to comment.