* Remove Subsystems map and replace with RegisterSubSystem
* Clean up the logger
* Fix LOGFLAGS and make LongFile work correctly
* Parallelize the logger backend
* More logger cleanup
* Initialize and close the logger backend wherever it's needed
* Move the location where the backend is closed, also print the log if it panics while writing
* Add TestMain to reachability manager tests to preserve the same log level
* Fix review comments
Co-authored-by: Svarog <feanorr@gmail.com>
* Add Close() function to all the iterators
* Add defer iterator.Close() whenever we open an iterator
* Add isClosed to all iterators and panic/return error if used after closing
Co-authored-by: Svarog <feanorr@gmail.com>
* 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.
* 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.
* 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>
* Use hard-coded sample config instead of assumed path
* Fix bad path to sample-kaspad.conf in TestCreateDefaultConfigFile
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
* Reuse the ticker in ConnectionManager.waitTillNextIteration
* Fix a data race in ConnectionManager by locking the mutex
* Add a mutex to fakeRelayInvsContext in block relay flow test
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Prevent infinite tickers leaks in kaspaminer
* Reset ticker in ConnectionManager instead of allocating a new one
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* 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>
* 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.
* 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.
* 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
* Add archival cli flag
* If --archival was activated - don't delete anything
* Fix tests
* Still change block status to StatusHeaderOnly even in archival nodes
* Split messages.proto to p2p and rpc.
* Split messages.proto to p2p and rpc.
* Write a short intro to the RPC docs.
* Start documenting RPC calls.
* Use a custom protoc-gen-doc.
* Continue writing RPC documentation.
* Finish writing RPC documentation.
* Fix a formatting error.
* Fix merge errors.
* Fix formatting into protowire/README.md.
* Rerun go generate ..
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* ''
* ''
* ''
* Changes genesis block version to 0.
* a
* a
* All tests are done.
* All tests passed for changed block version from int32 to uint16
* Adds validation of rejecting blocks with unknown versions.
* Changes txn version from int32 to uint16.
* .
* Adds comments to exported functions.
* Change functions name from ConvertFromRpcScriptPubKeyToRPCScriptPubKey to ConvertFromAppMsgRPCScriptPubKeyToRPCScriptPubKey and from ConvertFromRPCScriptPubKeyToRpcScriptPubKey to ConvertFromRPCScriptPubKeyToAppMsgRPCScriptPubKey
* change comment to "ScriptPublicKey represents a Kaspad ScriptPublicKey"
* delete part (tx.Version < 0) that cannot be exist on the if statement.
* Revert protobuf version.
* Fix a comment.
* Fix a comment.
* Rename a variable.
* Rename a variable.
* Remove a const.
* Rename a type.
* Rename a field.
* Rename a field.
* Remove commented-out code.
* Remove dangerous nil case in DomainTransactionOutput.Clone().
* Remove a constant.
* Fix a string.
* Fix wrong totalScriptPubKeySize in transactionMassStandalonePart.
* Remove a constant.
* Remove an unused error.
* Fix a serialization error.
* Specify version types to be uint16 explicitly.
* Use constants.ScriptPublicKeyVersion.
* Fix a bad test.
* Remove some whitespace.
* Add a case to utxoEntry.Equal().
* Rename scriptPubKey to scriptPublicKey.
* Remove a TODO.
* Rename constants.
* Rename a variable.
* Add version to parseShortForm.
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: stasatdaglabs <stas@daglabs.com>
* Add a new message: BlockHeadersMessage.
* Add a new message: BlockHeadersMessage.
* Send a lot of headers as a single message instead of many small messages.
* Keep a short queue of blockHeadersMessages so that there's never a moment when the node is not validating and inserting headers
* Add a missing return statement.
* Remove MsgBlockHeader from payloads.
* Add a new message: BlockLocatorHighestHash.
* Add a new message: IBDBlockLocator.
* Implement HandleIBDBlockLocator.
* Reimplement findHighestSharedBlockHash.
* Make HandleIBDBlockLocator only return hashes that are in the selected parent chain of the target hash.
* Increase the cache sizes of blockRelationStore, reachabilityDataStore, and ghostdagDataStore.
* Fix wrong initial highHash in findHighestSharedBlockHash.
* Make go vet happy.
* Protect against receiving wrong messages when expecting MsgIBDBlockLocatorHighestHash.