16 Commits

Author SHA1 Message Date
stasatdaglabs
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.
2019-06-16 14:12:02 +03:00
Svarog
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
2019-05-14 14:05:36 +03:00
Svarog
e9ec8cd39c [NOD-142] Convert Height and ChainHeight to uint64 (#269)
* [NOD-142] Updated util.FastLog2Floor to work on uint64

* [NOD-142] Convert height and chainHeight to uint64

* [NOD-142] A couple fixes in comments of TestFastLog2Floor

* [NOD-142] Make spendableOutOffset uint64 too
2019-04-30 12:50:46 +03:00
Ori Newman
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()
2019-04-02 13:49:47 +03:00
stasatdaglabs
a82e6ae24a [DEV-92] Package blockdag tests (#177)
* [DEV-92] Covered blocknode.go with tests.

* [DEV-92] Added test for blockSet.highest. Fixed a bug in it.

* [DEV-92] Added tests for blockSet.subtract and blockSet.addSet.

* [DEV-92] Covered blockset.go with tests.

* [DEV-92] Got rid of some old stuff related to STXOs.

* [DEV-92] Covered error.go with tests.

* [DEV-92] Covered utxoSet with tests.

* [DEV-92] Fixed formatting.
2019-01-27 18:04:31 +02:00
Ori Newman
7093155c3a [DEV-234] Add to txindex method to return the block in which tx was accepted (or indication it was not accepted) (#116)
* [DEV-234] add TxAcceptedInBlock and TxBlocks

* [DEV-234] test TxAcceptedInBlock and TxBlocks

* [DEV-234] test TxAcceptedInBlock and TxFirstBlockRegion

* [DEV-234] rename selectedPathSet to selectedPathChain

* [DEV-234] set indexers db as part of index manager initialization

* [DEV-234] remove redudant dag instance in txindex

* [DEV-234] fix TestTxIndexConnectBlock and add DAGParams as part of config in DAGSetup

* [DEV-234] TestTxIndexConnectBlock make K=1 to make calculations easier

* [DEV-234] rename TxAcceptingBlock to BlockThatAcceptedTx

* [DEV-234] update block fields names in txindex_test.go

* [DEV-234] rename selectedPathChain -> selectedPathChainSet
2018-11-05 16:11:54 +02:00
Ori Newman
201d7e0207 [DEV-226] Fix sorting of hashes in blockset.hashes() (#98)
* [DEV-226] Fix sorting of hashes in blockset.hashes()

* [DEV-226] add TestHashes
2018-10-17 15:35:56 +03:00
Mike Zak
faf5efa455 [DEV-189] Fixed blockSet.highest() case when highest==nil 2018-10-08 18:03:58 +03:00
Ori Newman
0643b0d920 [DEV-189] invert arguments order of daghash.Less (#83)
* [DEV-189] invert arguments order or daghash.Less

* [DEV-189] invert arguments order of daghash.Less in blockset.highest

* [DEV-189] change to equivalent condition in Hash.Less to make it prettier
2018-10-07 16:44:29 +03:00
Ori Newman
3c88184b38 [DEV-169] add to BlockDAG TipHashes() and HighestTipHash() and remove Tiphashes() and SelectedTipHash from VirtualBlock (#82)
* [DEV-169] add to BlockDAG TipHashes() and HighestTipHash() and remove Tiphashes() and SelectedTipHash from VirtualBlock

* [DEV-169] move highest node logic to separate method of blockset
2018-10-07 13:07:30 +03:00
Ori Newman
df23d87503 [DEV-164] add bluest parent (#74)
* [DEV-164] use bluestParent from time calculations

* [DEV-164] use bluestParent next difficulty calculations

* [DEV-164] get rid of blockset.first()
2018-10-04 10:35:22 +03:00
Ori Newman
4b78fd007d [DEV-84] validate block parents order
* [DEV-84] validate block parents order

* [DEV-84] change AreEqual to look for order equality as well
2018-08-14 16:15:12 +03:00
Ori Newman
713b01c69d [DEV-86] Update BlockDAG.initDAGState to load the whole dag
* [DEV-86] remove selectedPrevBlock from initDAGState

* [DEV-86] re-implement dagview to be dag compatible

* [DEV-86] change comments
2018-08-12 12:07:28 +03:00
Ori Newman
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
2018-08-02 16:34:40 +03:00
stasatdaglabs
f4a0ec175d [DEV-45] Update blockdag package tests for primitive blockDAG (#24)
* [DEV-45] Updated the BlockDB files to contain blocks that could be deserialized.

* [DEV-45] Fixed TestHaveBlock (finally)

* [DEV-45] Fixed TestLocateInventory and everything that's reliant on chainview_test::chainedNodes.

* [DEV-45] Fixed TestChainViewNil.

* [DEV-45] Fixed TestNotifications.

* [DEV-45] Fixed ExampleBlockChain_ProcessBlock.

* [DEV-45] Fixed TestCheckBlockScripts.

* [DEV-45] Fixed TestCheckConnectBlockTemplate.

* [DEV-45] Renamed the BlockDBs to their original names.

* [DEV-45] Skipping TestFullBlocks for until we have implemented Phantom.

* [DEV-45] Deleted a couple of methods that are no longer used. (They were previously used for reorganization)
2018-07-11 17:09:35 +03:00
stasatdaglabs
79a0c1f124 [DEV-43] Change UTXOViewpoint.BestHash() to Tips() and update all related logic (#15)
* [DEV-43] Changed BestHash to Tips, fixed logic inside utxoviewpoint.go.

* [DEV-43] Fixed broken references.

* [DEV-43] Replaced blockNode slices and hash slices with BlockSets.

* [DEV-43] Did some renaming, unexported blockSet, and rewrote AppendTip as AddBlock.

* [DEV-43] Removed explicit contains check from AddBlock.
2018-07-01 15:52:56 +03:00