Skip to content
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

Don't default-initialize RPC Transaction type #2470

Merged
merged 1 commit into from
May 15, 2024

Conversation

hrxi
Copy link
Contributor

@hrxi hrxi commented May 14, 2024

Instead, try to find a sensible value for each field. Previously, the hash was zero-initialized, for example.

Fixes #2465.

@hrxi
Copy link
Contributor Author

hrxi commented May 14, 2024

I'd expect the HistoricTransaction hash to be correct, since that's how we would be able to look it up again. Is my reasoning correct?

Copy link
Member

@sisou sisou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works! I see correct tx hashes and can query the txs by those hashes as well! 👍

Instead, try to find a sensible value for each field. Previously, the
hash was zero-initialized, for example.

Fixes #2465.
@jsdanielh jsdanielh force-pushed the hrxi/rpc_reward_tx_hash branch from c7cbfdc to 397c7fe Compare May 15, 2024 03:41
@jsdanielh jsdanielh merged commit 397c7fe into albatross May 15, 2024
6 checks passed
@jsdanielh jsdanielh deleted the hrxi/rpc_reward_tx_hash branch May 15, 2024 04:23
@jsdanielh jsdanielh added this to the Nimiq PoS Mainnet milestone May 16, 2024
block_number: Some(macro_block.block_number()),
timestamp: Some(macro_block.timestamp()),
confirmations: cur_block_height.map(|h| h - macro_block.block_number()),
from: Address::default(),
Copy link
Member

@sisou sisou May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this in the review, but you changed the sender from the Policy::COINBASE_ADDRESS to Address::default(), which are different addresses.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it in de902e5.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have alerted you to this, sorry. Is there a reason to prefer the all-zeros address over the coinbase address? As far as I understood it, the COINBASE address is the one where new coins come from?

Copy link
Member

@sisou sisou May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the question, did you switch the address names in your second sentence?

This code here is converting reward inherents into transactions, so of course the tx should have the coinbase as sender.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just found this:

pub fn into_transaction(self) -> Result<ExecutedTransaction, IntoTransactionError> {

Can't we use that method here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, you changed it back to COINBASE because I accidentally changed it to the all-zeros address. I got confused. Thanks for fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reward transactions in RPC macro block all have a zero hash
3 participants