-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request missing address while receiving new last address #748
request missing address while receiving new last address #748
Conversation
lib/archethic/p2p/message.ex
Outdated
Contracts.stop_contract(local_last_address) | ||
end | ||
|
||
process_notify_last_transaction_address(notify_last_tx_address_msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing the implementation from the message processing as it is used only here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to be able to unit test this implementation, and to keep the code simple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find test for how the message get processed, do we need to test this or it should be incorporated in a e2e test somewhere else ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Send message is mocked, but you can do something like Mocking the message, and in the mock just call Message.process
and it will run the process function on the right message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/archethic/p2p/message.ex
Outdated
}) do | ||
with {local_last_address, _} <- TransactionChain.get_last_address(genesis_address), | ||
true <- local_last_address != last_address do | ||
{:ok, tx} = TransactionChain.get_transaction(last_address) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you receive this message, it means that you didn't replicate the last transaction, so using TransactionChain.get_transaction
to fetch the transaction from DB will always fail.
I think the previous address has to be added in the message itself, because nodes which sent this message know it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it makes sens, I will do that thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #713
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: