* Adding support for mass.
* update grpc v1.69.2
* Upgrade protos using latest protoc
* Use MassCommitment instead of Mass
* Fix DomainTransaction clone, equal and tests
---------
Co-authored-by: veronica <jimjouny@gmail.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* Add fee estimation to wallet
* Add fee rate to kaspawallet parse
* Update go version
* Get rid of golint
* Add RBF support to wallet
* Fix bump_fee UTXO lookup and fix wrong change address
* impl storage mass as per KIP9
* Use CalculateTransactionOverallMass where needed
* Some fixes
* Minor typos
* Fix test
* update version
* BroadcastRBF -> BroadcastReplacement
* rc3
* align proto files to only use camel case (fixed on RK as well)
* Rename to FeePolicy and add MaxFee option + todo
* apply max fee constrains
* increase minChangeTarget to 10kas
* fmt
* Some fixes
* fix description: maximum -> minimum
* put min feerate check in the correct location
* Fix calculateFeeLimits nil handling
* Add validations to CLI flags
* Change to rc6
* Add checkTransactionFeeRate
* Add failed broadcast transactions on send error`
* Fix estimateFee change value
* Estimate fee correctly for --send-all
* On estimateFee always assume that the recipient has ECDSA address
* remove patch version
---------
Co-authored-by: Michael Sutton <msutton@cs.huji.ac.il>
* Call UpdatePruningPointIfRequired when resolving virtual
* Don't sanity check pruning point UTXO set if it's genesis
* Add UpdatePruningPointIfRequired on init
* Logger: change log level for "Couldn't find UTXO entry" to debug
* ignore error for orphans
* continue also if orphans
* check if blocks exist
* safe rpc mode
* limit window size
* verify block status depending on context
* allow a 2 factor gap in expected mergeset size
Co-authored-by: msutton <mikisiton2@gmail.com>
* 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>
* include utxoIndex and isNearlySynced in GetInfo
* fmt fixing
* add missing IsNearlySynced
* change `isNearlySynced` -> `isSynced` & `isUtxoIndexSet` ->`isUtxoIndexed`
* Add a check for `HasPeers` to make `isSynced` identical to `GetBlockTemplate.isSynced`
Co-authored-by: msutton <mikisiton2@gmail.com>
* Move OnBlockAdded event to the channel that was only used by virtualChanged events
* Don't send notifications for header-only and invalid blocks
* Return block status from block processor and use it for event raising decision
* Use MaybeEnqueue for consensus events
* go lint
* Fix RPC call to actually include tx ids
Co-authored-by: msutton <mikisiton2@gmail.com>
* Increase virtualChangeChan to 100e3
Don't crash when sending UTXO RPC notification to a closed route
Throw error if virtualChangeChan is full
* Use MaybeEnqueue in more places
* Remove comment
* Ignore capacity reached errors on MaybeEnqueue
* Allow blank address in NotifyUTXOsChanged to get all updates
* To see if address is possible to extract: Check for NonStandardTy rather than error
* Don't swallow errors
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>
* Add "sweep" command to kaspawallet
* minor linting & layout improvements.
* contain code in "sweep"
* update to sweep.go
* formatting and bugs
* clean up renaming of ExtractTransaction functions
* Nicer formating of display
* address reveiw.
* one more sweeped -> swept
* missed one reveiw comment. (extra mass).
* remove redundant code from split function.
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* protobuf for new block template notification structs
* appmessage and wire for new block template notification structs
* Set up the entire handler/call-chain for managing the new-block-template event
* Add GetUTXOsByBalances command to rpc
* Fix wrong commands in GetBalanceByAddress
* Moved calculation of TransactionMass out of TransactionValidator, so t that it can be used in kaspawallet
* Allow CreateUnsignedTransaction to return multiple transactions
* Start working on split
* Implement maybeSplitTransactionInner
* estimateMassIncreaseForSignatures should multiply by the number of inputs
* Implement createSplitTransaction
* Implement mergeTransactions
* Broadcast all transaction, not only 1
* workaround missing UTXOEntry in partially signed transaction
* Bugfix in broadcast loop
* Add underscores in some constants
* Make all nets RelayNonStdTxs: false
* Change estimateMassIncreaseForSignatures to estimateMassAfterSignatures
* Allow situations where merge transaction doesn't have enough funds to pay fees
* Add comments
* A few of renames
* Handle missed errors
* Fix clone of PubKeySignaturePair to properly clone nil signatures
* Add sanity check to make sure originalTransaction has exactly two outputs
* Re-use change address for splitAddress
* Add one more utxo if the total amount is smaller then what we need to send due to fees
* Fix off-by-1 error in splitTrasnaction
* Add a comment to maybeAutoCompoundTransaction
* Add comment on why we are increasing inputCountPerSplit
* Add comment explaining while originalTransaction has 1 or 2 outputs
* Move oneMoreUTXOForMergeTransaction to split_transaction.go
* Allow to add multiple utxos to pay fee for mergeTransactions, if needed
* calculate split input counts and sizes properly
* Allow multiple transactions inside the create-unsigned-transaction -> sign -> broadcast workflow
* Print the number of transaction which was sent, in case there were multiple
* Rename broadcastConfig.Transaction(File) to Transactions(File)
* Convert alreadySelectedUTXOs to a map
* Fix a typo
* Add comment explaining that we assume all inputs are the same
* Revert over-refactor of rename of config.Transaction -> config.Transactions
* Rename: inputPerSplitCount -> inputsPerSplitCount
* Add comment for splitAndInputPerSplitCounts
* Use createSplitTransaction to calculate the upper bound of mass for split transactions
* add p2p v5 which is currently identical to v4
* set all internal imports to v5
* set default version to 5
* Send pruning point and its anticone in batches
* go lint
* Fix jsom format
* Use DequeueWithTimeout
* Assert that batch size < route capacity
* oops, this is a flow handler, by definition it needs to be w/o a timeout
* here however, a timeout is required
* Keep IDs of prev messages unmodified
* previous merge operation accidentally erased an important part of this pr
* Extend timeout of simple sync
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* add p2p v5 which is currently identical to v4
* set all internal imports to v5
* wip
* set default version to 5
* protobuf gen for new ibd chain locator
* wire for new ibd chain locator types
* new ibd shared block algo -- only basic test passing
* address the case where pruning points disagree, now both IBD tests pass
* protobuf gen for new past diff request message
* wire for new request past diff message
* handle and flow for new request past diff message - logic unimplemented yet
* implement ibd sync past diff of relay and selected tip
* go fmt
* remove unused methods
* missed one err check
* addressing simple comments
* apply the traversal limit logic and sort headers
* rename pastdiff -> anticone
* apply Don't relay blocks in virtual anticone #1970 to v5
* go fmt
* Fixed minor comments
* Limit the number of chain negotiation restarts
* Make kaspawallet store the utxos sorted by amount, so that the bigger utxos are spent first - making it less likely a compound will be required
* Start refactor addEntryToUTXOSet
* Add GetUTXOsByBalances command to rpc
* Store list of addresses, updated with the collectAddresses methods
(replacing collectUTXOs methods)
* Fix wrong commands in GetBalanceByAddress
* Rename: refreshExistingUTXOs -> refreshUTXOs
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* 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
* Address manager refactor stage 1
* Use a simpler weightedRand function which makes it easier parameterize to the process
* Switch back to connectionFailedCount
* Simplify selected entry deletion
* Fix function comment
Co-authored-by: Constantine Bitensky <cbitensky1@gmail.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
* 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>
* Seed from DNS only if we ran out of addresses to connect to
* Remove address if it has failed 10 connections
* Change connectionFailedCountForRemove to 3
* Disallow by default RPC submission of out of date blocks (blocks which are out of virtual DAA window)
* go fmt
* Better condition test
* Make allowNonDAABlocks an RPC field and not a command line flag
* go fmt
* one more go fmt
* Get rid of genesis's UTXO dump
* Allow known orphans when AllowSubmitBlockWhenNotSynced=true
* gofmt
* Avoid IBD without changing the pruning point when only genesis is available
* Add DisallowDirectBlocksOnTopOfGenesis=true for mainnet
* Remove any mention to nobanning to let stability tests run
* Rename ifGenesisSetUtxoSet to loadUTXODataForGenesis
Co-authored-by: Ori Newman <>
* UTXO dump of block 0fca37ca667c2d550a6c4416dad9717e50927128c424fa4edbebc436ab13aeef
* Activate HF immediately and change reward to 1000
* Change protocol version and datadir location
* Delete comments
* Fix zero hash to muhash zero hash in genesis utxo dump check
* Don't omit genesis as direct parent
* Fix tests
* Change subsidy to 500
* Dont assume genesis multiset is empty
* Fix BlockReward test
* Fix TestValidateAndInsertImportedPruningPoint test
* Fix pruning point genesis utxo set
* Fix tests related to mainnet utxo set
* Dont change the difficulty before you have a full window
* Fix TestBlockWindow tests
* Remove global utxo set variable, and persist mainnetnet utxo deserialization between runs
* Fix last tests
* Make peer banning opt-in
* small fix for a test
* Fix go lint
* Fix Ori's review comments
* Change DAA score of genesis to checkpoint DAA score and fix all tests
* Fix the BlockLevel bits counting
* Fix some tests and make them run a little faster
* Change datadir name back to kaspa-mainnet and change db path from /data to /datadir
* Last changes for the release and change the version to 0.11.5
Co-authored-by: Ori Newman <orinewman1@gmail.com>
Co-authored-by: Ori Newman <>
Co-authored-by: msutton <mikisiton2@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 <>
* Decrease the dial timeout to 1 second
* Don't set blocks from the pruning point anticone as the header selected tip.
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>