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

Refactor files #298

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Conversation

Naviabheeman
Copy link
Contributor

@Naviabheeman Naviabheeman commented Mar 1, 2024

This PR is only refactoring of validation.cpp file. There is no code modification, it is only code move. This PR does not change behaviour. No new tests are added.

New files:

  1. chainstate.h and chainstate.cpp
  • these two files now contain all the chain state class and global chain state, g_chainstate.
  1. cs_main.h and cs_main.cpp
  • This is similar to bitcoin. These files contains global mutex cs_main and cs_LastBlockFile. This makes accessing. these two critical sections from multiple files possible.
  1. file_io.h and file_io.cpp
  • All disk operations are moved to these new files
  1. scriptcheck.h
  • contains CScriptCheck class
  1. verifydb.h and verifydb.cpp
  • contains CVerifyDB class
  1. blockprune.h and blockprune.cpp
  • global functions that are related to block pruning are in these files

remove mempool - it is a global
add all other flags in one struct
add all outputs in the same struct
packages are vector of transactions just like bitcoin. coins from the package being validated are kept in CTxMempoolView like bitcoin
Because of the structure of our accept to mempool code, package validation can be achieved with much less code change.
const CTxMempool is changed to non-const
remove mempool - it is a global
add all other flags in one struct
add all outputs in the same struct
remove mempool - it is a global
add all other flags in one struct
add all outputs in the same struct
change test result according to new output
add colored coin issue and spend in the same package
refactor package rpcs to return well formed rpcs
fix otherf ailing test cases
    validation.cpp - only transaction and block validation code
    verifydb.cpp - veridydb class
    chainstate.cpp - chainstate class and other helper code used in it
    cs_main.cpp - common critical sections
    file_io.cpp - all disk read and write operations
    blockprune.cpp - blockprune class
@Naviabheeman Naviabheeman requested a review from azuchi June 12, 2024 12:57
ENABLE_WALLET=true
ENABLE_UTILS=true
ENABLE_BITCOIND=true
ENABLE_ZMQ=true
Copy link
Contributor

Choose a reason for hiding this comment

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

This file unecessary.

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.

2 participants