* Adds tests for validateDifficulty
* fixes according to the review notes: adding the test's goal and fix an unmatch test name on the NewTestConsensus.
* Fixes according to the review notes:delete the function genesisBits - No usages.
* Fix according to review - fix comments.
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Make antiPastHashesBetween return blocks sorted in ghostdag-order
* Return sortedMergeSet instead of blueMergeSet
* Invert the order of parameters of IsAncestorOf
* Add RenderDAGToDot to TestConsensus
* Add HighHash explicitly, unless lowHash == highHash
* Use Equal instead of == when comparing hashes
* Fixed TestSyncManager_GetHashesBetween
* Fix tests
* findHighHashAccordingToMaxBlueScoreDifference: don't start looking if the whole thing fits
* Handle a missed error
* Remove redundant call to RenderToDot
* Fix bug in findHighHashAccordingToMaxBlueScoreDifference
* Move existing address/bannedAddress functionality to a new addressStore object.
* Implement TestAddressManager.
* Implement serializeAddressKey and deserializeAddressKey.
* Implement serializeNetAddress and deserializeNetAddress.
* Store addresses and banned addresses to disk.
* Implement restoreNotBannedAddresses.
* Fix bannedDatabaseKey.
* Implement restoreBannedAddresses.
* Implement TestRestoreAddressManager.
* Defer closing the database in TestRestoreAddressManager.
* Defer closing the database in TestRestoreAddressManager.
* Add a log.
* Return errors where appropriate.
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
* In PropagateUTXOsChangedNotifications, add the given addresses to the address list instead of replacing them.
* Add StopNotifyingUtxosChangedRequestMessage to rpc.proto.
* Implement StopNotifyingUTXOsChanged.
* Optimize convertUTXOChangesToUTXOsChangedNotification.
* Don't error out if antiPastHashesBetween have 2 blocks with the same blue score
* Prepend lowHash to RPC GetBlocks request
* Add a test for GetHashesBetween
* Add a test for GetBlocks RPC call
* Update antipast.go
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
* Rename debuglevel to loglevel
* Limit stdout level to info by default
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
Co-authored-by: Svarog <feanorr@gmail.com>
* Remove BlockHexes from GetBlocks request and response
* Add GetBlocks RPC
* Include the selectedTip's anticone in GetBlocks
* Add Anticone to fakeRelayInvsContext
* Include verbose data only if it was requested + Add comments to HandleGetBlocks
* Allow antiPastHashesBetween to receive unrelated low and high hashes
* Convert to/from protowire GetBlocksResponse with no verbose data correctly
* Removed NextLowHash
* Update GetBlocks in rpc_client
* Validate in consensus.Anticone that blockHash exists
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
* Send peers the hash of the virtual selected parent once connection is established.
* Add a log to SendVirtualSelectedParentInv.
* Fix TestIBDWithPruning.
* Fix TestIBDWithPruning better and signal from the IBD syncer to the IBD syncee that the DAG is split amongst them.
* Fix TestVirtualSelectedParentChain.
* Add comments.
* Split deletePastBlocks into sub-routines
* Remove SelectedParentIterator, and refactor SelectedChildIterator to support First and Error
* Implement PruneAllBlocks
* Prune all blocks in the store
* Prune only blocks that are below the pruning point
* Defer call onEnd of LogAndMeasureExecutionTime
* Handle a forgotten error
* Minor style fixes
* Adds tests for the "blockAtDepth" function and verify old other tests.
* Optimization on create the Dag chain.
* Changes according to the review - more detailed error messages, added constants, changed to 3 independent graphs (instead of extending), and changes all the abbreviations.
* Changes according to the review - divide the test into three separate tests and change names to variables.
* Changes according to the review - the order of the function has changed.
* delete double lines
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: Svarog <feanorr@gmail.com>
* Make leveldb cache configurable
* Fix leveldb tests
* Add a preallocate option to all caches and disable in tests
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
* Move testGHOSTDagSorter to testutils
* Allow overriding managers in consensus, starting with ghostdag
* Add test prefix to SetDataDir and SetGHOSTDAGManager
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
* Allow GetMissingBlockBodyHashes return an empty list if the missing blocks were requested before IBD start
* Add link to issue in comment about error to be fixed
* Limit mempool size to million transactions and remove the least profitable transactions
* Simplify insert
* Fix typo
* Improve findTxIndexInOrderedTransactionsByFeeRate readability
* Refactor miner and mine when waiting for block to validate
* Fix -n to work after the refactor.
Change foundBlockChan capacity.
Use lock instead of atomic in the template manager.
* Fix self assignment
* Fix lock
* Fix Dockerfile
* Add comment
* Add dummy go files for test only package, to mitigate golang/go#27333
* Stop ignoring errors when producing the coverage
* Add comments explaining the dummy go files
* Make the coverage output non-json