* Add request_types and their help
* Added command parser
* Updated main to use command if it's specified
* Some progress in making everything work
* Fix command parser for pointers to structs
* Cleanup code
* Enhance usage text
* Fixed typo
* Some minor style fixing, and remove temporary code
* Correctly fallthrough in stringToValue unsupported types
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
* Ignore ErrDuplicateBlock for any blocks that were requested
* Don't check for DuplicateBlockErr in processHeaders + improve logs
* Return the check for ErrDuplicateBlock in processHeader
* Fix log message
* Implement TestGetPruningPointUTXOs.
* Fix a bad error message.
* Fix TestGetPruningPointUTXOs for testnet.
* Make sure all the UTXOs are returned in TestGetPruningPointUTXOs.
* Implement BenchmarkGetPruningPointUTXOs.
* Pass fromOutpoint into GetPruningPointUTXOs instead of offset, so it could Seek over the cursor.
* Fix weird benchmark timer calls.
* Remove unnecessary collection of outpointAndUTXOEntryPairs from BenchmarkGetPruningPointUTXOs.
* Fix a comment.
* Remove pruningPointUTXOSetStaging and implement UpdatePruningPointUTXOSet.
* Implement StageStartSavingNewPruningPointUTXOSet, HadStartedSavingNewPruningPointUTXOSet, and FinishSavingNewPruningPointUTXOSet.
* Fix a bad return.
* Implement UpdatePruningPointUTXOSetIfRequired.
* Call UpdatePruningPointUTXOSetIfRequired on consensus creation.
* Rename savingNewPruningPointUTXOSetKey to updatingPruningPointUTXOSet.
* Add a log.
* Add calls to runtime.GC() at its start and end.
* Rename a variable.
* Replace calls to runtime.GC to calls to LogMemoryStats.
* Wrap the contents of LogMemoryStats in a log closure.
* Replaced the content of MsgIBDRootUTXOSetChunk with pairs of outpoint-utxo entry pairs.
* Rename utxoIter to utxoIterator.
* Add a big stinky TODO on an assert.
* Replace pruningStore staging with a UTXO set iterator.
* Reimplement receiveAndInsertIBDRootUTXOSet.
* Extract OutpointAndUTXOEntryPairsToDomainOutpointAndUTXOEntryPairs into domainconverters.go.
* Pass the outpoint and utxy entry pairs to the pruning store.
* Implement InsertCandidatePruningPointUTXOs.
* Implement ClearCandidatePruningPointUTXOs.
* Implement UpdateCandidatePruningPointMultiset.
* Use the candidate pruning point multiset in updatePruningPoint.
* Implement CandidatePruningPointUTXOIterator.
* Use the pruning point utxo set iterator for StageVirtualUTXOSet.
* Defer ClearCandidatePruningPointUTXOs.
* Implement OverwriteVirtualUTXOSet.
* Implement CommitCandidatePruningPointUTXOSet.
* Implement BeginOverwritingVirtualUTXOSet and FinishOverwritingVirtualUTXOSet.
* Implement overwriteVirtualUTXOSetAndCommitPruningPointUTXOSet.
* Rename ClearCandidatePruningPointUTXOs to ClearCandidatePruningPointData.
* Add missing methods to dbManager.
* Implement PruningPointUTXOs.
* Implement RecoverUTXOIfRequired.
* Delete the utxoserialization package.
* Fix compilation errors in TestValidateAndInsertPruningPoint.
* Switch order of operations in the if statements in PruningPointUTXOs so that Next() wouldn't be unnecessarily called.
* Fix missing pruning point utxo set staging and bad slice length.
* Fix no default multiset in InsertCandidatePruningPointUTXOs.
* Make go vet happy.
* Rename candidateXXX to importedXXX.
* Do some more renaming.
* Rename some more.
* Fix bad MsgIBDRootNotFound logic.
* Fix an error message.
* Simplify receiveIBDRootBlock.
* Fix error message in receiveAndInsertIBDRootUTXOSet.
* Do some more renaming.
* Fix merge errors.
* Fix a bug caused by calling iterator.First() unnecessarily.
* Remove databaseContext from stores and don't use a transaction in ClearXXX functions.
* Simplify receiveAndInsertIBDRootUTXOSet.
* Fix offset count in PruningPointUTXOs().
* Fix readOnlyUTXOIteratorWithDiff.First().
* Split handleRequestIBDRootUTXOSetAndBlockFlow into smaller methods.
* Rename IbdRootNotFound to UnexpectedPruningPoint.
* Rename requestIBDRootHash to requestPruningPointHash.
* Rename IBDRootHash to PruningPointHash.
* Rename RequestIBDRootUTXOSetAndBlock to RequestPruningPointUTXOSetAndBlock.
* Rename IBDRootUTXOSetChunk to PruningPointUTXOSetChunk.
* Rename RequestNextIBDRootUTXOSetChunk to RequestNextPruningPointUTXOSetChunk.
* Rename DoneIBDRootUTXOSetChunks to DonePruningPointUTXOSetChunks.
* Rename remaining references to IBD root.
* Fix an error message.
* Add a check for HadStartedImportingPruningPointUTXOSet in commitVirtualUTXODiff.
* Add a check for HadStartedImportingPruningPointUTXOSet in ImportPruningPointUTXOSetIntoVirtualUTXOSet.
* Move FinishImportingPruningPointUTXOSet closer to HadStartedImportingPruningPointUTXOSet.
* Remove reference to pruningStore in utxoSetIterator.
* Pointerify utxoSetIterator receivers.
* Fix bad insert in CommitImportedPruningPointUTXOSet.
* Rename commitImportedPruningPointUTXOSetAll to applyImportedPruningPointUTXOSet.
* Simplify PruningPointUTXOs.
* Add populateTransactionWithUTXOEntriesFromUTXOSet.
* Fix a TODO comment.
* Rename InsertImportedPruningPointUTXOs to AppendImportedPruningPointUTXOs.
* Extract handleRequestPruningPointUTXOSetAndBlockMessage to a separate method.
* Rename stuff in readOnlyUTXOIteratorWithDiff.First().
* Address toAddIterator in readOnlyUTXOIteratorWithDiff.First().
* Call First() before any full iteration on ReadOnlyUTXOSetIterator.
* Call First() before any full iteration on a database Cursor.
* Put StartImportingPruningPointUTXOSet inside the pruning point transaction.
* Make serializeOutpoint and serializeUTXOEntry free functions in pruningStore.
* Fix readOnlyUTXOIteratorWithDiff.First().
* Fix bad validations in importPruningPoint.
* Remove superfluous call to validateBlockTransactionsAgainstPastUTXO.
* Add the Address of node to whom connected in log of send/receiveVersion
* Don't call functions before LogAndMeasureExecutionTime
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Fix checkParentHeadersExist and cover pruning_violation_proof_of_work_and_difficulty.go with tests
* Remove unused variable
* Change consensus violation
* Change condition order
* Get rid of irrelevant error codes in extractRejectCode
* Fix wrong test db names
* Fix checkParentHeadersExist
* Extract syncPruningPointUTXOSet to a separate method.
* Implement logic to send pruning point utxo set chunks in a loop.
* Replace IBDRootUTXOSetAndBlockMessage with IbdRootUtxoSetChunkMessage.
* Add a new message: RequestNextIBDRootUTXOSetChunk.
* Add a new message: DoneIBDRootUTXOSetChunks.
* Protect HandleRequestIBDRootUTXOSetAndBlock from rogue messages.
* Reimplement receiveIBDRootUTXOSetAndBlock.
* Add CmdDoneIBDRootUTXOSetChunks to the HandleRelayInvs flow.
* Decrease the max message size to 10mb.
* Fix bad step.
* Fix confusion between outgoing/incoming routes.
* Measure how long it takes to send/receive the UTXO set.
* Use LogAndMeasure in handleRequestIBDRootUTXOSetAndBlockFlow.
* Prevent a race condition in findHighestSharedBlockHash where we get headersSelectedTip and then pass it as highHash to GetBlockLocator, without locking consensus
* Restart findHighestSharedBlockHash if lowHash or highHash are no longer in selectedParentChain
* Test for specifically ErrBlockNotInSelectedParentChain instead of database NotFound error
* Fix TestCreateHeadersSelectedChainBlockLocator
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Log the hashrate of each block
* Add a test for GetHashrateString
* Move difficulty related functions to its own package
* Convert the validated log in validateAndInsertBlock to a log function
* Add tests for max/min int
* Adds test for error cases on the function checkBlockStatus.
* Fix review's comments.
* Move test to validateandinsertblock_test.go
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Increase default log sizes, and increase kaspad log sizes
* Add an option to not print logs to stdout
* Allow logs to be printed in the current working directory
* Add more pruning related logs
* Add comment and increase log rotations to save last 64 logs
* Fix UTXO serialization, its test, and the static check that missed it
* Remove duplicate case
* Use one line for static check
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
* Add selected chain store and optimize block locator with it
* Fix build error
* Fix comments
* Fix IsStaged
* Rename CalculateSelectedParentChainChanges to CalculateChainPath and SelectedParentChainChanges->SelectedChainPath
* Use binary.LittleEndian directly to allow compiler optimizations
* Remove boolean from HeadersSelectedChainStore interface
* Prevent endless loop in block locator
* Initalize protoUTXOSetIterator with index = -1
* Handle error when failed to deserialize Script version
* Add support for (de)serialization of (u)int16
* Log the error when converting it into ErrMalformedUTXO
* commit for do fetch&merge
* Adds a new test to validate POW, and Fix Main-net and Testnet genesis block data.
* Fix window's test for testnet and change the expected pruning point for mainnet and testnet.
* Delete function "solveBlock" on proof_of_work_test.go and call the function mining.SolvaBlock instead. Also, remove using of random in "solveBlockWithWrongPOW" function.
* Replace 0xFFFFFFFFFFFFFFFF to math.MaxUint64 in "solveBlockWithWrongPOW" function and change the function's comment of "TestPOW"
* Replace 0xFFFFFFFFFFFFFFFF to math.MaxUint64 in "solveBlockWithWrongPOW" function and change the function's comment of "TestPOW"
* Change from <= to < in the for statement in "solveBlockWithWrongPOW" function
* Adds one arg to the function call "NewTestConsensus" (the function sig has changed).
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>