Skip to content
This repository has been archived by the owner on Nov 27, 2019. It is now read-only.

Commit

Permalink
fix: wrong second signature registration ID being computed (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
spkjp authored and faustbrian committed Jul 12, 2018
1 parent 06316f2 commit 6d7a419
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/arkecosystem/crypto/crypto.ex
Expand Up @@ -55,7 +55,7 @@ defmodule ArkEcosystem.Crypto.Crypto do
sender_public_key = transaction.sender_public_key
|> Base.decode16!(case: :lower)

recipient_id = if Map.has_key?(transaction, :recipient_id) do
recipient_id = if Map.has_key?(transaction, :recipient_id) && not is_nil(transaction.recipient_id) do
Base58Check.decode58check(transaction.recipient_id)
else
String.duplicate(<<0>>, 21)
Expand Down
5 changes: 3 additions & 2 deletions lib/arkecosystem/crypto/deserializer.ex
Expand Up @@ -232,8 +232,9 @@ defmodule ArkEcosystem.Crypto.Deserializer do

transaction = case transaction.type do
@second_signature_registration ->
recipient_id = EcKey.public_key_to_address(transaction.sender_public_key, transaction.network)
Map.put(transaction, :recipient_id, recipient_id)
# https://github.com/ArkEcosystem/core/issues/754
# recipient_id = EcKey.public_key_to_address(transaction.sender_public_key, transaction.network)
Map.put(transaction, :recipient_id, nil)

@vote ->
recipient_id = EcKey.public_key_to_address(transaction.sender_public_key, transaction.network)
Expand Down
14 changes: 7 additions & 7 deletions test/fixtures/transactions/second_signature_registration.json
Expand Up @@ -2,17 +2,17 @@
"version": 1,
"network": 30,
"type": 1,
"timestamp": 4895203,
"senderPublicKey": "03a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933",
"timestamp": 41271867,
"senderPublicKey": "034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192",
"fee": 500000000,
"asset": {
"signature": {
"publicKey": "0292d580f200d041861d78b3de5ff31c6665b7a092ac3890d9132593beb9aa8513"
"publicKey": "03699e966b2525f9088a6941d8d94f7869964a000efe65783d78ac82e1199fe609"
}
},
"signature": "3045022100e4fe1f3fb2845ad5f6ab377f247ffb797661d7516626bdc1d2f0f73eca582b4d02200ada103bdbff439d57c7aaa266f30ce74ff4385f0c77a486070033061b71650c",
"signature": "304402202aab49477dd3531e4473196d08fbd7c00ebb79223d5eaaeaf02c52c4041a86cf02201a7d82655f9b1d22af3ea94e6f183649bb4610cdeca3b9e20d6c8773f869831c",
"amount": 0,
"recipientId": "D7seWn8JLVwX4nHd9hh2Lf7gvZNiRJ7qLk",
"id": "62c36be3e5176771a476d813f64082a8f4e3861c0356438bdf1cc91eebcc9b0d",
"serialized": "ff011e01e3b14a0003a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de9330065cd1d00000000000292d580f200d041861d78b3de5ff31c6665b7a092ac3890d9132593beb9aa85133045022100e4fe1f3fb2845ad5f6ab377f247ffb797661d7516626bdc1d2f0f73eca582b4d02200ada103bdbff439d57c7aaa266f30ce74ff4385f0c77a486070033061b71650c"
"recipientId": null,
"id": "6d1615924d172d352c8f44d4ded84cbbece3c03ebb3e4fc3f3334784ae332590",
"serialized": "ff011e013bc27502034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed1920065cd1d000000000003699e966b2525f9088a6941d8d94f7869964a000efe65783d78ac82e1199fe609304402202aab49477dd3531e4473196d08fbd7c00ebb79223d5eaaeaf02c52c4041a86cf02201a7d82655f9b1d22af3ea94e6f183649bb4610cdeca3b9e20d6c8773f869831c"
}

0 comments on commit 6d7a419

Please sign in to comment.