* Add oldPruningPoint to pruningStore
* Make the pruning store work with utxo diff and return an iterator over pruning point utxoset
* Redesign pruning point utxo storage by creating a diff and modifying the old pruning utxo set
* Fix review comments
* Rename updatePruningPointUTXOSet
* Add ECDSA support
* Add domain separation to ECDSA sighash
* Use InfallibleWrite instead of Write
* Rename funcs
* Fix wrong use if vm.sigCache
* Add TestCalculateSignatureHashECDSA
* Add consts
* Fix comment and test name
* Move consts to the top
* Fix comment
* 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.
* Add mass limit to mempool
* Pass only params instead of multiple configuration options
* Remove acceptNonStd from mempool constructor
* Remove acceptNonStd from mempool constructor
* Fix test compilation
* [NOD-1429] add mining manager unit tests
* [NOD-1429] Add additional test
* found a bug, so stopped working on this test until the bug will be fix.
* Update miningmanager_test.go test.
* Delete payloadHash field - not used anymore in the current version.
* Change the condition for comparing slices instead of pointers.
* Fix due to review notes - change names, use testutils.CreateTransaction function and adds comments.
* Changes after fetch&merge to v0.10.0-dev
* Create a new function createChildTxWhenParentTxWasAddedByConsensus and add a comment
* Add an argument to create_transaction function and fix review notes
* Optimization
* Change to blockID(instead of the all transaction) in the error messages and fix review notes
* Change to blockID(instead of the all transaction) in the error messages and fix review notes
* Change format of error messages.
* Change name ofa variable
* Use go:embed to embed sample-kaspad.conf (only on go1.16)
* Revert "Use go:embed to embed sample-kaspad.conf (only on go1.16)"
This reverts commit bd28052b92b5a36f2ea826188d6876fddaf1802d.
Co-authored-by: karim1king <karimkaspersky@yahoo.com>
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Add StagingArea struct
* Implemented staging areas in blockStore
* Move blockStagingShard to separate folder
* Apply staging shard to acceptanceDataStore
* Update blockHeaderStore with StagingArea
* Add StagingArea to BlockRelationStore
* Add StagingArea to blockStatusStore
* Add StagingArea to consensusStateStore
* Add StagingArea to daaBlocksStore
* Add StagingArea to finalityStore
* Add StagingArea to ghostdagDataStore
* Add StagingArea to headersSelectedChainStore and headersSelectedTipStore
* Add StagingArea to multisetStore
* Add StagingArea to pruningStore
* Add StagingArea to reachabilityDataStore
* Add StagingArea to utxoDiffStore
* Fix forgotten compilation error
* Update reachability manager and some more things with StagingArea
* Add StagingArea to dagTopologyManager, and some more
* Add StagingArea to GHOSTDAGManager, and some more
* Add StagingArea to difficultyManager, and some more
* Add StagingArea to dagTraversalManager, and some more
* Add StagingArea to headerTipsManager, and some more
* Add StagingArea to constnsusStateManager, pastMedianTimeManager
* Add StagingArea to transactionValidator
* Add StagingArea to finalityManager
* Add StagingArea to mergeDepthManager
* Add StagingArea to pruningManager
* Add StagingArea to rest of ValidateAndInsertBlock
* Add StagingArea to blockValidator
* Add StagingArea to coinbaseManager
* Add StagingArea to syncManager
* Add StagingArea to blockBuilder
* Update consensus with StagingArea
* Add StagingArea to ghostdag2
* Fix remaining compilation errors
* Update names of stagingShards
* Fix forgotten stagingArea passing
* Mark stagingShard.isCommited = true once commited
* Move isStaged to stagingShard, so that it's available without going through store
* Make blockHeaderStore count be avilable from stagingShard
* Fix remaining forgotten stagingArea passing
* commitAllChanges should call dbTx.Commit in the end
* Fix all tests tests in blockValidator
* Fix all tests in consensusStateManager and some more
* Fix all tests in pruningManager
* Add many missing stagingAreas in tests
* Fix many tests
* Fix most of all other tests
* Fix ghostdag_test.go
* Add comment to StagingArea
* Make list of StagingShards an array
* Add comment to StagingShardID
* Make sure all staging shards are pointer-receiver
* Undo bucket rename in block_store
* Typo: isCommited -> isCommitted
* Add comment explaining why stagingArea.shards is an array
* 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
* [NOD-1424] Write general unit-tests for Reachability
* Update the tests of reachabilityManager.
* Add a diagram for the created DAG in the test.
* Change tabs to spaces in the diagram.
Co-authored-by: karim1king <karimkaspersky@yahoo.com>
Co-authored-by: tal <tal@daglabs.com>
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
* Save DAA score and DAA added blocks for each block
* Add test
* Add pruning support
* Replace 8 with uint64Length
* Separate DAABlocksStore cache size to DAA score and daaAddedBlocks
* Move timesorter to its own package and remove unused functions
* Remove padding+genesis from BlockWindow
* Adjust the difficulty even when there's less than difficultyAdjustmentWindowSize blocks
* Remove unnecessary check from checkBlockTransactionsFinalized
* Update tests with new pastMedianTime and Difficulty
* Review nit
* Write better tests for red blocks and DAA
* Fix comments
* Fix blue chain size
* Remove high timestamps from blue chain
Co-authored-by: Svarog <feanorr@gmail.com>
* Refactor mergeSetIncrease to return the current BFS block to allow easier merging
* Remove unneeded Heap/HashSet usages
* Add new IsAnyAncestorOf to DagTopolyManager
* Check if the new candidate is in the future of any existing candidate
* Add comments and fix off-by-one in the mergeSetIncrease queue
* Fixed DAGToplogy test mock
* Fix review 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>
* 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>
* resolveSingleBlockStatus: If the block being resolved is not going to be the next selectedTip - set it's diffParent to be the old selectedTip
* resolveSingleBlockStatus: If the block being resolved is going to be the next selectedTip - set it as old selectedTip's diffChild
* Remove any mentions of virtualDiffParents
* If block is genesis - don't do all the mumbo-jumbo with oldSelectedTip
* Check an unchecked error
* Write a better log message
* [NOD-1453] cover failing block validation
* [NOD-1453] Complete covering test for invalid block
* [NOD-1453] Fix validator tests after rebase
* [NOD-1453] Cover tests for valid blocks
* [NOD-1453] Implement unit tests for ValidateTransactionInIsolation
* [NOD-1453] Add tests for ValidateTransactionInContextAndPopulateMassAndFee
* [NOD-1453] Cover ValidateHeaderInContext test
* [NOD-1453] Fix after rebase
* not finish
* commited for update the branch.
* Adds new tests to block_body_in_isolation_test.go according to (and instead of ) blockvalisator_test.go
* Adds a comment to type MEDIAN.
* Fixes according to the review notes: add notes and change variables name.
* Fix comment.
* Remove an unused test( all the tests in this file were passed to other test files).
* Change a variable name(txWithAnEmptyInvalidScript to txWithInvalidSignature).
* adds missing '}'.
* Change spaces to tab
Co-authored-by: karim1king <karimkaspersky@yahoo.com>
Co-authored-by: Karim A <karim.a@it-dimension.com>
Co-authored-by: tal <tal@daglabs.com>
* 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
* 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>
* 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>
* 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