mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
12 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
![]() |
193add502f
|
[NOD-716] Fix a crash in GetTopHeaders. (#615) | ||
![]() |
2174a0a7f2 |
[NOD-497] Implement GHOSTDAG (#575)
* [NOD-540] Implement reachability (#545) * [NOD-540] Begin implementing reachability. * [NOD-540] Finish implementing reachability. * [NOD-540] Implement TestIsFutureBlock. * [NOD-540] Implement TestInsertFutureBlock. * [NOD-540] Add comments. * [NOD-540] Add comment for interval in blockNode. * [NOD-540] Updated comments over insertFutureBlock and isFutureBlock. * [NOD-540] Implement interval splitting methods. * [NOD-540] Begin implementing tree manipulation in blockNode. * [NOD-540] Implement countSubtreesUp. * [NOD-540] Add a comment explaining an impossible condition. * [NOD-540] Implement applyIntervalDown. * [NOD-540] Moved the reachability tree stuff into reachability.go. * [NOD-540] Add some comments. * [NOD-540] Add more comments, implement isInPast. * [NOD-540] Fix comments. * [NOD-540] Implement TestSplitFraction. * [NOD-540] Implement TestSplitExact. * [NOD-540] Implement TestSplit. * [NOD-540] Add comments to structs. * [NOD-540] Implement TestAddTreeChild. * [NOD-540] Fix a comment. * [NOD-540] Rename isInPast to isAncestorOf. * [NOD-540] Rename futureBlocks to futureCoveringSet. * [NOD-540] Rename isFutureBlock to isInFuture. * [NOD-540] move reachabilityInterval to the top of reachability.go. * [NOD-540] Change "s.t." to "such that" in a comment. * [NOD-540] Fix indentation. * [NOD-540] Fix a potential bug involving float inaccuracy. * [NOD-540] Wrote a more descriptive error message. * [NOD-540] Fix error messsage. * [NOD-540] Fix the recursive countSubtreesUp. * [NOD-540] Rename countSubtreesUp to countSubtrees and applyIntervalDown to propagateInterval. * [NOD-540] Implement updating reachability for a valid new block. * [NOD-540] Implement a disk storage for reachability data. * [NOD-540] Fix not all tree nodes being written to the database. * [NOD-540] Implement serialization for reachabilityData. * [NOD-540] Implement some deserialization for reachabilityData. * [NOD-540] Implement restoring the reachabilityStore on node restart. * [NOD-540] Made interval and remainingInterval pointers. * [NOD-540] Rename setTreeInterval to setInterval. * [NOD-540] Rename reindexTreeIntervals to reindexIntervals and fixed the comment above it. * [NOD-540] Expand the comment above reindexIntervals. * [NOD-540] Fix comment above countSubtrees. * [NOD-540] Fix comment above countSubtrees some more. * [NOD-540] Fix comment above split. * [NOD-540] Fix comment above isAncestorOf. * [NOD-540] Fix comment above reachabilityTreeNode. * [NOD-540] Fix weird condition in addTreeChild. * [NOD-540] Rename addTreeChild to addChild. * [NOD-540] Fix weird condition in splitFraction. * [NOD-540] Reverse the lines in reachabilityTreeNode.String(). * [NOD-540] Renamed f to fraction and x to size. * [NOD-540] Fix comment above bisect. * [NOD-540] Implement rtn.isAncestorOf(). * [NOD-540] Use treeNode isAncestorOf instead of treeInterval isAncestorOf. * [NOD-540] Use newReachabilityInterval instead of struct initialization. * [NOD-540] Make reachabilityTreeNode.String() use strings.Join. * [NOD-540] Use sync.RWMutex instead of locks.PriorityMutex. * [NOD-540] Rename thisTreeNode to newTreeNode. * [NOD-540] Rename setTreeNode to addTreeNode. * [NOD-540] Extracted selectedParentAnticone to a separate function. * [NOD-540] Rename node to this. * [NOD-540] Move updateReachability and isAncestorOf from dag.go to reachability.go. * [NOD-540] Add whitespace after multiline function signatures in reachability.go. * [NOD-540] Make splitFraction return an error on empty interval. * [NOD-540] Add a comment about rounding to splitFraction. * [NOD-540] Replace sneaky tabs with spaces. * [NOD-540] Rename split to splitExponential. * [NOD-540] Extract exponentialFractions to a separate function. * [NOD-540] Rename bisect to findIndex. * [NOD-540] Add call to reachabilityStore.clearDirtyEntries at the end of saveChangesFromBlock. * [NOD-540] Explain the dirty hack in reachabilityStore.init(). * [NOD-540] Split the function signature for deserializeReachabilityData to two lines. * [NOD-540] Add a comment about float precision loss to exponentialFractions. * [NOD-540] Corrected a comment about float precision loss to exponentialFractions. * [NOD-540] Fixed a comment about float precision loss to exponentialFractions some more. * [NOD-540] Added further comments above futureCoveringBlockSet. * [NOD-540] Rename addTreeNode to setTreeNode. * [NOD-540] Rename splitExponential to splitWithExponentialBias. * [NOD-540] Fix object references in reachabilityData deserialization (#563) * [NOD-540] Fix broken references in deserialization. * [NOD-540] Fix broken references in futureCoveringSet deserialization. Also add comments. * [NOD-540] Don't deserialize on the first pass in reachabilityStore.init(). * [NOD-540] Remove redundant assignment to loaded[hash]. * [NOD-540] Use NewHash instead of SetBytes. Rename data to destination. * [NOD-540] Preallocate futureCoveringSet. * [NOD-541] Implement GHOSTDAG (#560) * [NOD-541] Implement GHOSTDAG * [NOD-541] Replace the old PHANTOM variant with GHOSTDAG * [NOD-541] Move dag.updateReachability to the top of dag.applyDAGChanges to update reachability before the virtual block is updated * [NOD-541] Fix blueAnticoneSize * [NOD-541] Initialize node.bluesAnticoneSizes * [NOD-541] Fix pastUTXO and applyBlueBlocks blues order * [NOD-541] Add serialization logic to node.bluesAnticoneSizes * [NOD-541] Fix GHOSTDAG to not count the new block and the blue candidates anticone, add selected parent to blues, and save to node.bluesAnticoneSizes properly * [NOD-541] Fix test names in inner strings * [NOD-541] Writing TestGHOSTDAG * [NOD-541] In blueAnticoneSize change node->current * [NOD-541] name ghostdag return values * [NOD-541] fix ghostdag to return slice * [NOD-541] Split k-cluster violation rules * [NOD-541] Add missing space * [NOD-541] Add comment to ghostdag * [NOD-541] In selectedParentAnticone rename past->selectedParentPast * [NOD-541] Fix misrefernces to TestChainUpdates * [NOD-541] Fix ghostdag comment * [NOD-541] Make PrepareBlockForTest in blockdag package * [NOD-541] Make PrepareBlockForTest in blockdag package * [NOD-541] Assign to selectedParentAnticone[i] instead of appending * [NOD-541] Remove redundant forceTransactions arguments from PrepareBlockForTEST * [NOD-541] Add non-selected parents to anticoneHeap * [NOD-541] add test for ghostdag * [NOD-541] Add comments * [NOD-541] Use adjusted time for initializing blockNode * [NOD-541] Rename isAncestorOf -> isAncestorOfBlueCandidate * [NOD-541] Remove params from PrepareBlockForTest * [NOD-541] Fix TestChainHeight * [NOD-541] Remove recursive lock * [NOD-541] Fix TestTxIndexConnectBlock * [NOD-541] Fix TestBlueBlockWindow * [NOD-541] Put prepareAndProcessBlock in common_test.go * [NOD-541] Fix TestConfirmations * [NOD-541] Fix TestAcceptingBlock * [NOD-541] Fix TestDifficulty * [NOD-541] Fix TestVirtualBlock * [NOD-541] Fix TestSelectedPath * [NOD-541] Fix TestChainUpdates * [NOD-541] Shorten TestDifficulty test time * [NOD-541] Make PrepareBlockForTest use minimal valid block time * [NOD-541] Remove TODO comment * [NOD-541] Move blockdag related mining functions to mining.go * [NOD-541] Use NextBlockCoinbaseTransaction instead of NextBlockCoinbaseTransactionNoLock in NextCoinbaseFromAddress * [NOD-541] Remove useMinimalTime from BlockForMining * [NOD-541] Make MedianAdjustedTime a *BlockDAG method * [NOD-541] Fix ghostdag to use anticone slice instead of heap * [NOD-541] Fix NewBlockTemplate locks * [NOD-541] Fix ghostdag comments * [NOD-541] Convert MedianAdjustedTime to NextBlockTime * [NOD-541] Fix ghostdag comment * [NOD-541] Fix TestGHOSTDAG comment * [NOD-541] Add comment before sanity check * [NOD-541] Explicitly initialize .blues in ghostdag * [NOD-541] Rename *blockNode.lessThan to *blockNode.less * [NOD-541] Remove redundant check if block != chainBlock * [NOD-541] Fix comment * [NOD-541] Fix comment * [NOD-497] Add comment; General refactoring * [NOD-497] General refactoring. * [NOD-497] Use isAncestor of the tree rather than the node * [NOD-497] Remove reachability mutex lock as it is redundant (dag lock is held so no need); General refactoring. * [NOD-497] Update comment * [NOD-497] Undo test blocktimestamp * [NOD-497] Update comments; Use BlockNode.less for blockset; * [NOD-497] Change processBlock to return boolean and not the delay duration (merge conflict) * [NOD-497] Undo change for bluest to use less; Change blocknode less to use daghash.Less Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com> Co-authored-by: Dan Aharoni <dereeno@protonmail.com> |
||
![]() |
369ec449a8 |
[NOD-509] Change organization name to kaspanet (#524)
* [NOD-509] Change organization name to kaspanet * [NOD-509] Reorganize imports |
||
![]() |
f4c6859e51 | [NOD-509] Updated repository and imports to github.com/daglabs/kaspad (#521) | ||
![]() |
ffd886498a |
[NOD-208] Make block reward maturity use the same mechanism as confirmations (#327)
* [NOD-208] Added blockBlueScore to UTXOEntry. * [NOD-208] Added blueBlockScore to NewUTXOEntry. * [NOD-208] Fixed compilation errors in policy, utxoset, and dag tests. * [NOD-208] Changed validateBlockRewardMaturity and CheckTransactionInputsAndCalulateFee to use blueScore. * [NOD-208] Changed CalcBlockSubsidy to use blueScore. * [NOD-208] Changed SequenceLockActive to use blueScore. * [NOD-208] Removed ExtractCoinbaseHeight. * [NOD-208] Removed reference to block height in ensureNoDuplicateTx. * [NOD-208] Changed IsFinalizedTransaction to use blueScore. * [NOD-208] Fixed merge errors. * [NOD-208] Made UTXOEntry serialization use blueScore. * [NOD-208] Changed CalcPriority and calcInputValueAge to use blueScore. * [NOD-208] Changed calcSequenceLock to use blueScore. * [NOD-208] Removed blockChainHeight from UTXOEntry. * [NOD-208] Fixed compilation errors in feeEstimator. Fixed a bug in the test pool hardness. * [NOD-208] Fixed oldestChainBlockWithBlueScoreGreaterThan not handling an extreme case. * [NOD-208] Fixed TestDiffFromTx. * [NOD-208] Got rid of priority and support of free transactions. * [NOD-208] Fixed TestProcessTransaction. * [NOD-208] Fixed TestTxFeePrioHeap. * [NOD-208] Fixed TestAddrIndex and TestFeeEstimatorCfg. * [NOD-208] Removed unused rateLimit parameter from ProcessTransaction. * [NOD-208] Fixed tests that rely on CreateTxChain. * [NOD-208] Fixed tests that rely on CreateSignedTxForSubnetwork. * [NOD-208] Fixed TestFetchTransaction. * [NOD-208] Fixed TestHandleNewBlock. Fixed HandleNewBlock erroneously processing fee transactions. * [NOD-208] Fixed TestTxIndexConnectBlock. * [NOD-208] Removed the use of Height() from the fee estimator. * [NOD-208] Removed unused methods from rpcwebsocket.go. * [NOD-208] Removed Height from util.Block. * [NOD-208] Removed ErrForkTooOld. It doesn't make sense in a DAG. * [NOD-208] Made blockHeap use blueScore instead of height. * [NOD-208] Removed fee estimator. * [NOD-208] Removed DAG.Height. * [NOD-208] Made TestAncestorErrors test chainHeight instead of height. * [NOD-208] Fixed a couple of comments that were still speaking about block height. * [NOD-208] Replaced all uses of HighestTipHash with SelectedTipHash. * [NOD-208] Remove blockNode highest and some remaining erroneous uses of height. * [NOD-208] Fixed a couple of comments. Fixed outPoint -> outpoint merge error. * [NOD-208] Fixed a couple more comments. * [NOD-208] Used calcMinRequiredTxRelayFee instead of DefaultMinRelayTxFee for mempool tests. * [NOD-208] Renamed mempool Config BestHeight to DAGChainHeight. * [NOD-208] Fixed a bug in oldestChainBlockWithBlueScoreGreaterThan. Made calcSequenceLock use the node's selected parent chain rather than the virtual block's. * [NOD-208] Removed chainHeight from blockNode String(). Renamed checkpointsByHeight to checkpointsByChainHeight and prevCheckpointHeight to prevCheckpointChainHeight. Removed reference to chainHeight in blockIndexKey. Fixed comments in dagio.go. * [NOD-208] Removed indexers/blocklogger.go, as no one was using it. * [NOD-208] Made blocklogger.go log blueScore instead of height. * [NOD-208] Fixed typo. * [NOD-208] Fixed comments, did minor renaming. * [NOD-208] Made a "common sense" wrapper around sort.Search. * [NOD-208] Fixed comment in SearchSlice. |
||
![]() |
ca0619bbcf |
[NOD-176] Moved daghash from dagconfig to util (#298)
* [NOD-176] Moved daghash from dagconfig to util * [NOD-176] Fixed order of includes with gofmt |
||
![]() |
b612426ead | [NOD-67] Unexport blockheap (#257) | ||
![]() |
254eab96cd |
[NOD-55] Change daghash hash to pointer in most places (#239)
* [NOD-55] Change daghash.Hash to pointer in most places * [NOD-55] Fixed format error * [NOD-55] Fixed merge error * [NOD-55] Cancel copying hash in blockSet.hashes() |
||
![]() |
62d14bf2bd |
[NOD-16] implement initial sync first version (#234)
* [NOD-58] Replace lastBlock with selected tip in version message (#210) * [NOD-58] Replace lastBlock with selected tip in version message * [NOD-58] Fix typo in comment * [NOD-58] Add mutex to SelectedTipHash * [NOD-58] Remove redundant comment * [NOD-58] Remove wantStartingHeight from peerStats * [NOD-58] Remove lock from SelectedTipHash * Nod 53 change getheaders message to handle new block locator (#213) * [NOD-53] Change getheaders message to handle the new block locator mechanism * [NOD-53] Use heap in locateHeaders * [NOD-53] Create a constructor for each heap direction * [NOD-57] Check if a node is synced only by timestamps (#214) * [NOD-60] implement isSyncCandidate (#218) * [NOD-60] Implement isSyncCandidate * [NOD-60] Fix typo * [NOD-65] Fix netsync related tests and remove fields optionality from… (#220) * [NOD-65] Fix netsync related tests and remove fields optionality from msgversion * [NOD-65] gofmt rpcserver.go * [NOD-65] add missing test for verRelayTxFalse * [NOD-62] Change getblocks message to handle the new block locator mechanism (#219) * [NOD-62] Change getblocks message to handle the new block locator mechanism * [NOD-62] Add locateBlockNodes function * [NOD-68] Adjust orphan parents requesting for a DAG (#222) * [NOD-68] Adjust orphan parents requesting for a DAG * [NOD-68] add sendInvsFromRequestedQueue and trigger it when requested blocks slice is empty, or immediatly if we're not in sync mode * [NOD-68] Prevent duplicates from entering to state.requestQueue and add wrapping locks to addBlocksToRequestQueue * [NOD-68] Fix Lock -> Unlock in sendInvsFromRequestedQueue * [NOD-74] Starts syncing again when the current sync peer is done (#225) * [NOD-74] Starts syncing again when the current sync peer is done * [NOD-74] Unlock mtx before netsync is restarted * [NOD-74] Fix name isSyncPeerFree -> isWaitingForBlocks * [NOD-75] fixing netsync bugs (#227) * [NOD-74] Starts syncing again when the current sync peer is done * [NOD-74] Unlock mtx before netsync is restarted * [NOD-75] Fixing netsync bugs * [NOD-80] Request block data from block propagation just after you are… (#231) * [NOD-80] Request block data from block propagation just after you are current * [NOD-80] Fix adding to both queues in addInvToRequestQueue * [NOD-81] Start to mine on top of genesis iff all peers selected tip is genesis (#232) * [NOD-81] Start to mine on top of genesis only if all of your peers' selected tip is genesis * [NOD-81] Explain forAllPeers/forAllOutboundPeers shouldContinue behaviour in comments * [NOD-81] Add forAllInboundPeers and add return values for forAllPeers/forAllOutboundPeers/forAllInboundPeers functions * [NOD-16] Add pushSet to the BlockHeap type * [NOD-16] Fixed syntax error |
||
![]() |
3ace16ad23 |
[DEV-134] Implement Continuous Integration (#105)
* [DEV-134] Implement Continuous Integration Squashed commit: [5e41d830] Dev 223 fix txindex (#100) * [DEV-201] In handleGetBlockDAGInfo calculate difficulty by the tip with the lowest bits * [DEV-202] Move VirtualBlock.GetUTXOEntry to BlockDAG * [DEV-203] Move VirtualBlock.SelectedTip() to BlockDAG * [DEV-203] Move VirtualBlock.SelectedTip() to BlockDAG * [DEV-204] Unexport VirtualBlock() and add CalcMedianTime method for DAG * [DEV-204] add explanation about difficulty in CurrentBits() comment * [DEV-204] unexport VirtualBlock type * [DEV-223] make applyUTXOChanges return pastUTXOResults * [DEV-223] add bluestxdata for current block as well * [DEV-223] re-design tx index * [DEV-223] edit txindex comments * [DEV-223] rename BluesTxData -> AcceptedTxData, and return from applyUTXOChanges only transactions that got accepted * [DEV-223] add unit test for txindex * [DEV-223] fix comments and unite blueTransaction and AcceptedTxData to one type * [DEV-223] use bucket cursor for dbFetchFirstTxRegion * [DEV-223] use the same cursor instance for dbFetchFirstTxRegion * [DEV-223] write in dbFetchFirstTxRegion's comment that it returns the first block region * [DEV-223] rename type BlueBlockTransaction to TxWithBlockHash * [DEV-223] add named returned value for applyUTXOChanges [4c95e293] [DEV-134] Made golint ignore the vendor directory. [21736dbc] [DEV-134] Renamed ExampleBlockChain_ProcessBlock to ExampleBlockDAG_ProcessBlock to satisfy go vet. [beea6486] [DEV-134] Removed pushing the built docker to a remove repository. That's unnecessary at this stage. [bee911ed] [DEV-134] Made all precompilation checks run on everything instead of only the root dir. [585f92ae] [DEV-134] Added "github.com/pkg/errors" to dep. [5f02f570] [DEV-134] -vendor-only is written with only one hyphen. [3eee7f95] [DEV-134] go vet instead of go tool vet. [0c2d4343] [DEV-134] Split all the pre-compile checks to separate lines to be able to tell which of them is failing. [780519c8] [DEV-134] Ran gofmt on everything. [8247146b] Dev 223 fix txindex (#100) * [DEV-201] In handleGetBlockDAGInfo calculate difficulty by the tip with the lowest bits * [DEV-202] Move VirtualBlock.GetUTXOEntry to BlockDAG * [DEV-203] Move VirtualBlock.SelectedTip() to BlockDAG * [DEV-203] Move VirtualBlock.SelectedTip() to BlockDAG * [DEV-204] Unexport VirtualBlock() and add CalcMedianTime method for DAG * [DEV-204] add explanation about difficulty in CurrentBits() comment * [DEV-204] unexport VirtualBlock type * [DEV-223] make applyUTXOChanges return pastUTXOResults * [DEV-223] add bluestxdata for current block as well * [DEV-223] re-design tx index * [DEV-223] edit txindex comments * [DEV-223] rename BluesTxData -> AcceptedTxData, and return from applyUTXOChanges only transactions that got accepted * [DEV-223] add unit test for txindex * [DEV-223] fix comments and unite blueTransaction and AcceptedTxData to one type * [DEV-223] use bucket cursor for dbFetchFirstTxRegion * [DEV-223] use the same cursor instance for dbFetchFirstTxRegion * [DEV-223] write in dbFetchFirstTxRegion's comment that it returns the first block region * [DEV-223] rename type BlueBlockTransaction to TxWithBlockHash * [DEV-223] add named returned value for applyUTXOChanges [bff68aa3] [DEV-134] Gave executable permission to deploy.sh [638a99d9] [DEV-134] Added jenkinsfile and deploy script. * [DEV-134] Added a robust testing script. * [DEV-134] Fixed a bash-ism. * [DEV-134] Disabled testing with coverage for now. * [DEV-134] Disabled golint and removed removing debug symbols. * [DEV-134] Disabled aligncheck. * [DEV-134] Disabled structcheck and varcheck. * [DEV-134] Added "don't inline functions" to compiler flags for testing. * [DEV-134] Made build fail if gofmt prints out anything. * [DEV-134] Fixed misleading comment. * [DEV-134] Added comments to test.sh. * [DEV-134] Renamed tm to measure_runtime and removed do_ prefixes from functions. * [DEV-134] Fixed gofmt line in build script. * [DEV-134] Fixed gofmt some more. * [DEV-134] Fixed gofmt not actually failing due to logical or. |
||
![]() |
904f2cf2e3 |
[DEV-72] Write Blues()
* [DEV-62] add phantom constructs to blocknode * [DEV-62] add phantom constructs to blocknode * [DEV-72] write blues() * [DEV-72] write blues() * [DEV-72] write blues() * [DEV-62] add comments to new phantom constructs in blocknode * Fixed dbIndexConnectBlock. (#33) * Fixed dbIndexConnectBlock. * Removed redundant check in storeFilter. * Created a new method to BlockHeader: IsGenesis. * [DEV-71] Implement BlockHeap (#35) * [DEV-71] Implemented BlockHeap. * [DEV-71] Removed irrelevant comment. * [DEV-71] Renamed variables in Pop() and split Less() to multiple lines. * [DEV-72] write blues() * [DEV-72] write blues() * [DEV-72] write blues() * [DEV-72] write blues tests * [DEV-72] write blues tests * [DEV-72] remove relevant past * [DEV-72] write blues tests * [DEV-72] write blues tests * [DEV-72] write blues tests * [DEV-72] write functions to order blockSet by hash and write blue tests * [DEV-72] add secret mining and censorship attack tests * [DEV-72] remove prints * [DEV-72] remove K from dagconfig.Params * [DEV-72] remove K from dagconfig.Params * [DEV-72] change blueScore to uint64 * [DEV-72] block V was missing, so renamed w -> v, x -> w etc * [DEV-72] use node.String instead of %v * [DEV-72] block V was missing, so renamed w -> v, x -> w etc * [DEV-72] add K to dagconfig.Params, and add expected reds to all phantom tests * [DEV-72] set K=10 and add comments to phantom and phantom tests * [DEV-72] fix formatting and add comments to TestPhantom * [DEV-72] fix grammar |
||
![]() |
5f800890ec |
[DEV-71] Implement BlockHeap (#35)
* [DEV-71] Implemented BlockHeap. * [DEV-71] Removed irrelevant comment. * [DEV-71] Renamed variables in Pop() and split Less() to multiple lines. |