mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-15 18:46:39 +00:00

* 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
22 lines
557 B
Go
22 lines
557 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/app/appmessage"
|
|
"os"
|
|
)
|
|
|
|
func isUTXOSpendable(entry *appmessage.UTXOsByAddressesEntry, virtualSelectedParentBlueScore uint64, coinbaseMaturity uint64) bool {
|
|
if !entry.UTXOEntry.IsCoinbase {
|
|
return true
|
|
}
|
|
blockBlueScore := entry.UTXOEntry.BlockDAAScore
|
|
// TODO: Check for a better alternative than virtualSelectedParentBlueScore
|
|
return blockBlueScore+coinbaseMaturity < virtualSelectedParentBlueScore
|
|
}
|
|
|
|
func printErrorAndExit(err error) {
|
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
|
os.Exit(1)
|
|
}
|