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

Coinbase refactor #2876

Merged
merged 5 commits into from
Dec 5, 2024
Merged

Coinbase refactor #2876

merged 5 commits into from
Dec 5, 2024

Conversation

marcos-iov
Copy link
Contributor

Description

  • Refactor registerBtcCoinbase function for simplicity, add logs
  • Refactor findWitnessCommitment function, add tests
  • Search for blocks directly in storage instead of cache
  • Add a special case for a testnet block that was found in cache but not in storage, to keep consensus

Motivation and Context

How Has This Been Tested?

Unit tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)
  • Other information:

fed:coinbase-refactor

@marcos-iov marcos-iov requested a review from a team as a code owner December 5, 2024 14:53
Copy link

github-actions bot commented Dec 5, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

) {
byte[] rawBtcBlockHeader = HexUtils.stringHexToByteArray("000000203b5d178405c4e6e7dc07d63d6de5db1342044791721654760c00000000000000796cf6743a036300b43fb3abe6703d04a7999751b6d5744f20327d1175320bd37b954e66ffff001d56dc11ce");

BtcBlock btcBlockHeader = new BtcBlock(bridgeConstants.getBtcParams(), rawBtcBlockHeader);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
BtcBlock.BtcBlock
should be avoided because it has been deprecated.

// recreating the chainHead as real btc block 2_817_200 so blockDepth is not 0
byte[] chainHeadRawHeader = HexUtils.stringHexToByteArray("0000642d6b8df2c8ae4a20e20a10ae3b34e485701b8ae7e80ede0828040000000000000063a17c3e5063da2f8f952e496beee729932d35f62c0765baaf12f32931f01c9b49354f66ecd410190f25f402");
BtcBlock chainHeadHeader = new BtcBlock(bridgeTestnetConstants.getBtcParams(), chainHeadRawHeader);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
BtcBlock.BtcBlock
should be avoided because it has been deprecated.
@aeidelman aeidelman merged commit 1a073de into master Dec 5, 2024
13 checks passed
@aeidelman aeidelman deleted the coinbase-refactor branch December 5, 2024 17:44
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.

3 participants