* 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 <>
* Replace the old blockSubsidy parameters with the new ones.
* Return subsidyGenesisReward if blockHash is the genesis hash.
* Traverse a block's past for the subsidy calculation.
* Partially implement SubsidyStore.
* Refer to SubsidyStore from CoinbaseManager.
* Wrap calcBlockSubsidy in getBlockSubsidy, which first checks the database.
* Fix finalityStore not calling GenerateShardingID.
* Implement calculateAveragePastSubsidy.
* Implement calculateMergeSetSubsidySum.
* Implement calculateSubsidyRandomVariable.
* Implement calcBlockSubsidy.
* Add a TODO about floats.
* Update the calcBlockSubsidy TODO.
* Use binary.LittleEndian in calculateSubsidyRandomVariable.
* Fix bad range in calculateSubsidyRandomVariable.
* Replace float64 with big.Rat everywhere except for subsidyRandomVariable.
* Fix a nil dereference.
* Use a random walk to approximate the normal distribution.
* In order to avoid unsupported fractional results from powInt64, flip the numerator and the denominator manually.
* Set standardDeviation to 0.25, MaxSompi to 10_000_000_000 * SompiPerKaspa and defaultSubsidyGenesisReward to 1_000.
* Set the standard deviation to 0.2.
* Use a binomial distribution instead of trying to estimate the normal distribution.
* Change some values around.
* Clamp the block subsidy.
* Remove the fake duplicate constants in the util package.
* Reduce MaxSompi to only 100m Kaspa to avoid hitting the uint64 ceiling.
* Lower MaxSompi further to avoid new and exciting ways for the uint64 ceiling to be hit.
* Remove debug logs.
* Fix a couple of failing tests.
* Fix TestBlockWindow.
* Fix limitTransactionCount sometimes crashing on index-out-of-bounds.
* In TrustedDataDataDAABlock, replace BlockHeader with DomainBlock
* In calculateAveragePastSubsidy, use blockWindow instead of doing a BFS manually.
* Remove the reference to DAGTopologyManager in coinbaseManager.
* Add subsidy to the coinbase payload.
* Get rid of the subsidy store and extract subsidies out of coinbase transactions.
* Keep a blockWindow amount of blocks under the virtual for IBD purposes.
* Manually remove the virtual genesis from the merge set.
* Fix simnet genesis.
* Fix TestPruning.
* Fix TestCheckBlockIsNotPruned.
* Fix TestBlockWindow.
* Fix TestCalculateSignatureHashSchnorr.
* Fix TestCalculateSignatureHashECDSA.
* Fix serializing the wrong value into the coinbase payload.
* Rename coinbaseOutputForBlueBlock to coinbaseOutputAndSubsidyForBlueBlock.
* Add a TODO about optimizing trusted data DAA window blocks.
* Expand on a comment in TestCheckBlockIsNotPruned.
* In calcBlockSubsidy, divide the big.Int numerator by the big.Int denominator instead of converting to float64.
* Clarify a comment.
* Rename SubsidyMinGenesisReward to MinSubsidy.
* Properly handle trusted data blocks in calculateMergeSetSubsidySum.
* Use the first two bytes of the selected parent's hash for randomness instead of math/rand.
* Restore maxSompi to what it used to be.
* Fix TestPruning.
* Fix TestAmountCreation.
* Fix TestBlockWindow.
* Fix TestAmountUnitConversions.
* Increase the timeout in many-tips to 30 minutes.
* Check coinbase subsidy for every block
* Re-rename functions
* Use shift instead of powInt64 to determine subsidyRandom
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Replace the old parents in the block header with BlockLevelParents.
* Begin fixing compilation errors.
* Implement database serialization for block level parents.
* Implement p2p serialization for block level parents.
* Implement rpc serialization for block level parents.
* Add DirectParents() to the block header interface.
* Use DirectParents() instead of Parents() in some places.
* Revert test_block_builder.go.
* Add block level parents to hash serialization.
* Use the zero hash for genesis finality points.
* Fix failing tests.
* Fix a variable name.
* Update headerEstimatedSerializedSize.
* Add comments in blocklevelparents.go.
* Fix the rpc-stability stability test.
* Change the field number for `parents` fields in p2p.proto and rpc.proto.
* Remove MsgBlockHeader::NumParentBlocks.
* 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 BlockHash optional parameter to EstimateNetworkBlockHashesPerSecond
* Allow to pass '-' for optional values in kaspactl
* Solve a division-by-zero in estimateNetworkHashesPerSecond
* Add BlockHash to toAppMessage/fromAppMessage functions
* Rename: topHash -> StartHash
* Return proper error message if provided startHash doesn't deserialize into a hash
* Naive bip39 with address reuse
* Avoid address reuse in libkaspawallet
* Add wallet daemon
* Use daemon everywhere
* Add forceOverride
* Make CreateUnsignedTransaction endpoint receive amount in sompis
* Collect close UTXOs
* Filter out non-spendable UTXOs from selectUTXOs
* Use different paths for multisig and non multisig
* Fix tests to use non zero path
* Fix multisig cosigner index detection
* Add comments
* Fix dump_unencrypted_data.go according to bip39 and bip32
* Fix wrong derivation path for multisig on wallet creation
* Remove IsSynced endpoint and add validation if wallet is synced for the relevant endpoints
* Rename server address to daemon address
* Fix capacity for extendedPublicKeys
* Use ReadBytes instead of ReadLine
* Add validation when importing
* Increment before using index value, and use it as is
* Save keys file exactly where needed
* Use %+v printErrorAndExit
* Remove redundant consts
* Rnemae collectCloseUTXOs and collectFarUTXOs
* Move typedefs around
* Add comment to addressesToQuery
* Update collectUTXOsFromRecentAddresses comment about locks
* Split collectUTXOs to small functions
* Add sanity check
* Add addEntryToUTXOSet function
* Change validateIsSynced to isSynced
* Simplify createKeyPairsFromFunction logic
* Rename .Sync() to .Save()
* Fix typo
* Create bip39BitSize const
* Add consts to purposes
* Add multisig check for 'send'
* Rename updatedPSTxBytes to partiallySignedTransaction
* Change collectUTXOsFromFarAddresses's comment
* Use setters for last used indexes
* Don't use the pstx acronym
* Fix SetPath
* Remove spaces when reading lines
* Fix walletserver to daemonaddress
* Fix isUTXOSpendable to use DAA score
Co-authored-by: Svarog <feanorr@gmail.com>
* 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
* Implement importing private keys into the wallet.
* Fix bad --import default.
* Fix typo in --import annotation.
* Make go lint happy.
* Make go lint happier.
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Add a reconnect mechanism to RPCClient.
* Fix Reconnect().
* Connect the internal reconnection logic to the miner reconnection logic.
* Rename shouldReconnect to isClosed.
* Move safe reconnection logic from the miner to rpcclient.
* Remove sleep from HandleSubmitBlock.
* Properly handle client errors and only disconnect if we're already connected.
* Make go lint happy.
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* 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.
* 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>
* Refactor miner and mine when waiting for block to validate
* Fix -n to work after the refactor.
Change foundBlockChan capacity.
Use lock instead of atomic in the template manager.
* Fix self assignment
* Fix lock
* Fix Dockerfile
* Add comment
* Prevent infinite tickers leaks in kaspaminer
* Reset ticker in ConnectionManager instead of allocating a new one
Co-authored-by: Ori Newman <orinewman1@gmail.com>