* RPC: include orphans into mempool entries
* no need for + 1
* give request option to choose mempool pool(s)
* add to wallet, fix bg
* use orphanpool rpc to test for orphans
* fix fmt
* fix crash when quering orphan pool in get_mempool_entries
* pass the tests, fix fromAppMessage bug
* Update config_test.go
don't think this is needed
* needed for tests to pass
* inverse to transactionpoolfilter, cut down code to two ifs.
* fmt
* update test to true false, forgot one includetransactionpool renaming
* update and simplyfiy get_mempool_entry handler
* comment outdated
* i think we usually use make instead of var.
* Fix some leftovers of includeTransactionPool
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Fix RPC connections counting
* show incomming connections count
* Use the flag RPCMaxClients instead of the const RPCMaxInboundConnections
* Add grpc server name to log message
Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
* start
* pass tests, (cannot get before put!) and clean up.
* add rpc call.
* create and pass tests, fix bugs. fully implement rpc
* As always fmt
* remover old test
* clean up proto comment
* put the logger back in place.
* revert back to 10 sec limit.
* migration, change utxoChanged removal to whole utxoEntryPair, add methods to update circulating supply, intialize circulating supply from reset.
* Update utxoindex.go
* ad
* rename to max, change comment
* one more total to max
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Add acceptedTransactionIds to GetVirtualSelectedParentChainFromBlockResponseMessage and VirtualSelectedParentChainChangedNotificationMessage
* Modify appmessage structs to include new fields
* Implement the functionality for acceptedTransactionID notifications
* Add missing field for IncludeAcceptedTransactionIds
* Notify of block added before notifying that chain changed
* Use consensushashing instead of Transaction.ID
* Don't notify of empty virtual changes
* Don't generate virtualChainChanged notification if there's nobody subscribed
* Fix test to not expect empty notifications
* Don't generate acceptedTransactionIDs if they were not requested by anyone
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Use separate than finality depth for merge set calculations after HF
* Add comments and edit error messages
* Fix TestValidateTransactionInContextAndPopulateFee
* Don't disconnect from node if isViolatingBoundedMergeDepth
* Use new merge root for virtual pick parents; apply HF1 daa score split for validation only
* Use `blue work` heuristic to skip irrelevant relay blocks
* Minor
* Make sure virtual's merge depth root is a real block
* For ghostdag data we always use the non-trusted data
* Fix TestBoundedMergeDepth and in IBD use VirtualMergeDepthRoot instead of MergeDepthRoot
* Update HF1DAAScore
* Make sure merge root and finality are called + avoid calculating virtual root twice
* Update block version to 1 after HF
* Update to v0.12.0
Co-authored-by: msutton <mikisiton2@gmail.com>
* Split ApplyPruningPointProof to multiple small database transactions.
* Increase the timeout duration in TestIBDWithPruning.
* Increase the timeout duration in simple-sync.
* Explain that if ApplyPruningPointProof fails, the database must be discarded.
* Separate IBD to a new flow (so now invs are handled concurrently and no route capacity errors)
* Invs messages should be queued while waiting for BlockLocator msg
* Close IBD channel so that HandleIBDFlow exits too
* Apply flow separation to p2p protocol v4
* Manage the IBDRequestChannel through the Peer struct
* Some IBDs take a little longer
* Copy blockrelay flows to v4
* Remove duplicate sending of the same DAA blocks
* Advance testnet version
* Renames and add comments
* Add IBD test between v3 and v4
* Fix syncee v4 p2p version
* Check if netsync finished with selected tip
* Implement upgrade mechanism for p2p
* Remove dependencies from flowcontext to v3
* Add p2p v4
* Add Ready flow
* Remove copy paste code of v3
* Register SendAddresses flow at the top level
* Add option to set protocol version from CLI and add TestAddressExchangeV3V4
* Send ready message on minimal net adapter
* Rename defaultMaxProtocolVersion->maxAcceptableProtocolVersion
* Fix stability test mining (allow submission of non DAA blocks too)
* Comments for go fmt
* Use SubmitBlockAlsoIfNonDAA for all tests
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
* Modify DefaultTimeout to 120 seconds
A temporary workaround for nodes having trouble to sync (currently the download of pruning point related data during IBD takes more than 30 seconds)
* Cache existence in reachability store
* Cache block level in the header
* Fix IBD indication on submit block
* Add hardForkOmitGenesisFromParentsDAAScore logic
* Fix NumThreads bug in the wallet
* Get rid of ParentsAtLevel header method
* Fix a bug in BuildPruningPointProof
* Increase race detector timeout
* Add cache to BuildPruningPointProof
* Add comments and temp comment out go vet
* Fix ParentsAtLevel
* Dont fill empty parents
* Change HardForkOmitGenesisFromParentsDAAScore in fast netsync test
* Add --allow-submit-block-when-not-synced in stability tests
* Fix TestPruning
* Return fast tests
* Fix off by one error on kaspawallet
* Fetch only one block with trusted data at a time
* Update fork DAA score
* Don't ban for unexpected message type
* Fix tests
Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
Co-authored-by: Ori Newman <>
* Implement a MinerState to cache the matrix and friends
* Modify the miner and related code to use the new MinerCache
* Change MinerState to State
* Make go lint happy
Co-authored-by: Ori Newman <orinewman1@gmail.com>
Co-authored-by: Kaspa Profiler <>
* Calculate GHOSTDAG, reachability etc for each level
* Don't preallocate cache for dag stores except level 0 and reduce the number of connections in the integration test to 32
* Reduce the number of connections in the integration test to 16
* Increase page file
* BuildPruningPointProof
* BuildPruningPointProof
* Add PruningProofManager
* Implement ApplyPruningPointProof
* Add prefix and fix blockAtDepth and fill headersByLevel
* Some bug fixes
* Include all relevant blocks for each level in the proof
* Fix syncAndValidatePruningPointProof to return the right block hash
* Fix block window
* Fix isAncestorOfPruningPoint
* Ban for rule errors on pruning proof
* Find common ancestor for blockAtDepthMAtNextLevel
* Use pruning proof in TestValidateAndInsertImportedPruningPoint
* stage status and finality point for proof blocks
* Uncomment golint
* Change test timeouts
* Calculate merge set for ApplyPruningPointProof
* Increase test timeout
* Add better caching for daa window store
* Return to default timeout
* Add ErrPruningProofMissesBlocksBelowPruningPoint
* Add errDAAWindowBlockNotFound
* Force connection loop next iteration on connection manager stop
* Revert to Test64IncomingConnections
* Remove BlockAtDepth from DAGTraversalManager
* numBullies->16
* Set page file size to 8gb
* Increase p2p max message size
* Test64IncomingConnections->Test16IncomingConnections
* Add comment for PruningProofM
* Add comment in `func (c *ConnectionManager) Stop()`
* Rename isAncestorOfPruningPoint->isAncestorOfSelectedTip
* Revert page file to 16gb
* Improve ExpectedHeaderPruningPoint perf
* Fix comment
* Revert "Improve ExpectedHeaderPruningPoint perf"
This reverts commit bca1080e7140c78d510f51bbea858ae280c2f38e.
* Don't test windows
* Replace header finality point with pruning point
* Fix TestTransactionAcceptance
* Fix pruning candidate
* Store all past pruning points
* Pass pruning points on IBD
* Add blue score to block header
* Simplify ArePruningPointsInValidChain
* Fix static check errors
* Fix genesis
* Renames and text fixing
* Use ExpectedHeaderPruningPoint in block builder
* Fix TestCheckPruningPointViolation
* Implement GHOST.
* Implement TestGHOST.
* Make GHOST() take arbitrary subDAGs.
* Hold RootHashes in SubDAG rather than one GenesisHash.
* Select which root the GHOST chain starts with instead of passing a lowHash.
* If two child hashes have the same future size, decide which one is larger using the block hash.
* Extract blockHashWithLargestFutureSize to a separate function.
* Calculate future size for each block individually.
* Make TestGHOST deterministic.
* Increase the timeout for connecting 128 connections in TestRPCMaxInboundConnections.
* Implement BenchmarkGHOST.
* Fix an infinite loop.
* Use much larger benchmark data.
* Optimize `futureSizes` using reverse merge sets.
* Temporarily make the benchmark data smaller while GHOST is being optimized.
* Fix a bug in futureSizes.
* Fix a bug in populateReverseMergeSet.
* Choose a selectedChild at random instead of the one with the largest reverse merge set size.
* Rename populateReverseMergeSet to calculateReverseMergeSet.
* Use reachability to resolve isDescendantOf.
* Extract heightMaps to a separate object.
* Iterate using height maps in futureSizes.
* Don't store reverse merge sets in memory.
* Change calculateReverseMergeSet to calculateReverseMergeSetSize.
* Fix bad initial reverseMergeSetSize.
* Optimize calculateReverseMergeSetSize.
* Enlarge the benchmark data to 86k blocks.
* Limit the amount of inbound RPC connections.
* Increment/decrement the right variable.
* Implement TestRPCMaxInboundConnections.
* Make go vet happy.
* Increase RPCMaxInboundConnections to 128.
* Set NUM_CLIENTS=128 in the rpc-idle-clients stability test.
* Explain why the P2P server has unlimited inbound connections.
* Pruning headers p2p basic structure
* Remove headers-first
* Fix consensus tests except TestValidateAndInsertPruningPointWithSideBlocks and TestValidateAndInsertImportedPruningPoint
* Add virtual genesis
* Implement PruningPointAndItsAnticoneWithMetaData
* Start fixing TestValidateAndInsertImportedPruningPoint
* Fix TestValidateAndInsertImportedPruningPoint
* Fix BlockWindow
* Update p2p and gRPC
* Fix all tests except TestHandleRelayInvs
* Delete TestHandleRelayInvs parts that cover the old IBD flow
* Fix lint errors
* Add p2p_request_ibd_blocks.go
* Clean code
* Make MsgBlockWithMetaData implement its own representation
* Remove redundant check if highest share block is below the pruning point
* Fix TestCheckLockTimeVerifyConditionedByAbsoluteTimeWithWrongLockTime
* Fix comments, errors ane names
* Fix window size to the real value
* Check reindex root after each block at TestUpdateReindexRoot
* Remove irrelevant check
* Renames and comments
* Remove redundant argument from sendGetBlockLocator
* Don't delete staging on non-recoverable errors
* Renames and comments
* Remove redundant code
* Commit changes inside ResolveVirtual
* Add comment to IsRecoverableError
* Remove blocksWithMetaDataGHOSTDAGDataStore
* Increase windows pagefile
* Move DeleteStagingConsensus outside of defer
* Get rid of mustAccepted in receiveBlockWithMetaData
* Ban on invalid pruning point
* Rename interface_datastructures_daawindowstore.go to interface_datastructures_blocks_with_meta_data_daa_window_store.go
* * Change GetVirtualSelectedParentChainFromBlockResponseMessage and VirtualSelectedParentChainChangedNotificationMessage to show only added block hashes
* Remove ResolveVirtual
* Use externalapi.ConsensusWrapper inside MiningManager
* Fix pruningmanager.blockwithmetadata
* Set pruning point selected child when importing the pruning point UTXO set
* Change virtual genesis hash
* replace the selected parent with virtual genesis on removePrunedBlocksFromGHOSTDAGData
* Get rid of low hash in block locators
* Remove +1 from everywhere we use difficultyAdjustmentWindowSize and increase the default value by one
* Add comments about consensus wrapper
* Don't use separate staging area when resolving resolveBlockStatus
* Fix netsync stability test
* Fix checkResolveVirtual
* Rename ConsensusWrapper->ConsensusReference
* Get rid of blockHeapNode
* Add comment to defaultDifficultyAdjustmentWindowSize
* Add SelectedChild to DAGTraversalManager
* Remove redundant copy
* Rename blockWindowHeap->calculateBlockWindowHeap
* Move isVirtualGenesisOnlyParent to utils
* Change BlockWithMetaData->BlockWithTrustedData
* Get rid of maxReasonLength
* Split IBD to 100 blocks each time
* Fix a bug in calculateBlockWindowHeap
* Switch to trusted data when encountering virtual genesis in blockWithTrustedData
* Move ConsensusReference to domain
* Update ConsensusReference comment
* Add comment
* Rename shouldNotAddGenesis->skipAddingGenesis
* Update constants
* Add to transaction SigOpCount
* Update mass calculation, and move it from InContext to InIsolation
* Update block validation accordingly
* Add SigOpCount validation during TransactionInContext
* Remove checking of mass vs maxMassAcceptedByBlock from consensusStateManager
* Update mining manager with latest changes
* Add SigOpCount to MsgTx.Copy()
* Fix initTestTransactionAcceptanceDataForClone
* Fix all tests in transaction_equal_clone_test.go
* Fix TestBlockMass
* Fix tests in transactionvalidator package
* Add SigOpCount to sighash
* Fix TestPruningDepth
* Fix problems in libkaspawalelt
* Fix integration tests
* Fix CalculateSignatureHash tests
* Remove remaining places talking about block size
* Add sanity check to checkBlockMass to make sure all transactions have their mass filled
* always add own sigOpCount to sigHash
* Update protowire/rpc.md
* Start working on removing any remaining reference to block/tx size
* Update rpc transaction verbose data to include mass rather then size
* Convert verboseData and block size check to mass
* Remove remaining usages of tx size in mempool
* Move transactionEstimatedSerializedSize to transactionvalidator
* Add PopulateMass to fakeRelayInvsContext
* Move PopulateMass to beggining of ValidateAndInsertTransaction + fix in it
* Assign mass a new number for backward-compatibility
* Add notifyVirtualDaaScoreChanged to protowire.
* Add notifyVirtualDaaScoreChanged to the rest of kaspad.
* Add notifyVirtualDaaScoreChanged to the rest of kaspad.
* Test the DAA score notification in TestVirtualSelectedParentBlueScore.
* Rename TestVirtualSelectedParentBlueScore to TestVirtualSelectedParentBlueScoreAndVirtualDAAScore.
(cherry picked from commit 83e631548f206aaf2da5b2103681c715bc250c75)
* Add windows to the CI
* Cast syscall.Stdin into an integer
* DataDir -> AppDir in service_windows.go
* Rename mempool-limits package to something non-main
* Close database after re-assigining to it
* Up rpcTimout to 10 seconds
* Replace BlockMessage with RpcBlock in rpc.proto.
* Convert everything in kaspad to use RPCBlocks and fix tests.
* Fix compilation errors in stability tests and the miner.
* Update TransactionVerboseData in rpc.proto.
* Update TransactionVerboseData in the rest of kaspad.
* Make golint happy.
* Include RpcTransactionVerboseData in RpcTransaction instead of the other way around.
* Regenerate rpc.pb.go after merge.
* Update appmessage types.
* Update appmessage request and response types.
* Reimplement conversion functions between appmessage.RPCTransaction and protowire.RpcTransaction.
* Extract RpcBlockHeader toAppMessage/fromAppMessage out of RpcBlock.
* Fix compilation errors in getBlock, getBlocks, and submitBlock.
* Fix compilation errors in getMempoolEntry.
* Fix compilation errors in notifyBlockAdded.
* Update verbosedata.go.
* Fix compilation errors in getBlock and getBlocks.
* Fix compilation errors in getBlocks tests.
* Fix conversions between getBlocks message types.
* Fix integration tests.
* Fix a comment.
* Add selectedParent to the verbose block response.
* Use BLAKE2B instead of HASH160, and get rid of any usage of RIPEMD160
* Change genesis coinbase payload script to OP_FALSE
* Fix tests after conflict
* Remove duplicate tests
* Change file name
* Change atomic swap to use proper hash size
* Move CalculateSignatureHash to consensushashing
* Added CalcSignatureHash_BIP143 with all parameters except the re-used hashes
* Add handling of outputHash
* Add sequencesHash to the mix
* Add previousOutputsHash to the mix
* Replace legacy CalculateSigHash with new one, and re-wire to all non-test code
* Add missing types to WriteElement
* Fix tests in txscript
* Fix tests in rest of code
* Add missing comments
* Add SubnetworkID and Gas to sigHash
* Add TestCalculateSignatureHash
* Invert condition in SigHashSingle getOutputsHash
* Explicitly define that payloadHash for native transactions is 0
* added benchmark to CalculateSignatureHash
* Reformat call for signAndCheck
* Change SigHashes to be true bit-fields
* Add check for transaction version
* Write length of byte array in WriteElement
* hashOutpoint should get outpoint, not txIn
* Use inputIndex instead of i to determine SigHashType
* Use correct transaction version + fix some typos
* Fix hashes in test
* Reformat an overly-long line
* Replace checkHashTypeEncoding with caalls to hashType.IsStandardSigHashType
* Convert hashType to uint8
* Add comment
* Replace blue score with DAA score in UTXO entries
* Use DAA score for coinbase maturity
* Use DAA score for sequence lock
* Fix calcBlockSubsidy to use DAA score
* Don't pay to blocks that are not included in the DAA added blocks, and bestow red blocks reward to the merging block
* Fix TestGetPruningPointUTXOs
* Fix TestTransactionAcceptance
* Fix TestChainedTransactions
* Fix TestVirtualDiff
* Fix TestBlockWindow
* Fix TestPruning
* Use NewFromSlice instead of manually creating the hash set
* Add assert
* Add comment
* Remove redundant call to UpdateDAADataAndReturnDifficultyBits
* Add RequiredDifficulty, rename UpdateDAADataAndReturnDifficultyBits to StageDAADataAndReturnRequiredDifficulty and add comments
* Make buildUTXOInvalidHeader get bits as an argument
* Fix comments
* 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>
* 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>
* 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
* 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
* ''
* ''
* ''
* 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>
* Fix notifyVirtualSelectedParentBlueScoreChanged to show the selected tip blue score instead of the virtual's
* Fix ShouldMine() to fetch selected tip header
* Increase size of reachability cache
* Change DomainHash to struct with unexported hashArray
* Fixing compilation errors stemming from new DomainHash structure
* Remove obsolete Read/WriteElement methods in appmessage
* Fix all tests
* Fix all tests
* Add comments
* A few renamings
* go mod tidy