diff --git a/blockchain/chainio.go b/blockchain/chainio.go index 43a5b6a7f2..0c00d13558 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -12,7 +12,7 @@ import ( "errors" "fmt" "math/big" - "sort" + "sync" "time" "github.com/decred/dcrd/blockchain/stake/v4" @@ -28,7 +28,7 @@ import ( const ( // currentDatabaseVersion indicates what the current database // version is. - currentDatabaseVersion = 8 + currentDatabaseVersion = 9 // currentBlockIndexVersion indicates what the current block index // database version. @@ -78,7 +78,7 @@ var ( // utxoSetBucketName is the name of the db bucket used to house the unspent // transaction output set. - utxoSetBucketName = []byte("utxosetv2") + utxoSetBucketName = []byte("utxosetv3") // blockIndexBucketName is the name of the db bucket used to house the block // index which consists of metadata for all known blocks both in the main @@ -249,15 +249,6 @@ func readDeserializeSizeOfMinimalOutputs(serialized []byte) (int, error) { return offset, nil } -// ConvertUtxosToMinimalOutputs converts the contents of a UTX to a series of -// minimal outputs. It does this so that these can be passed to stake subpackage -// functions, where they will be evaluated for correctness. -func ConvertUtxosToMinimalOutputs(entry *UtxoEntry) []*stake.MinimalOutput { - minOuts, _ := deserializeToMinimalOutputs(entry.stakeExtra) - - return minOuts -} - // ----------------------------------------------------------------------------- // The block index consists of an entry for every known block. It consists of // information such as the block header and information about votes. @@ -478,10 +469,20 @@ func dbMaybeStoreBlock(dbTx database.Tx, block *dcrutil.Block) error { // serialized in the reverse order they are spent because later transactions // are allowed to spend outputs from earlier ones in the same block. // +// The reserved field below used to keep track of the version of the containing +// transaction when the spent txout was the final unspent output of the +// containing transaction. The spent flag (which previously represented that +// the containing transaction was fully spent), is always set now, but the extra +// reserved field is kept to allow for backward compatibility. This was kept +// for backward compatibility, rather than migrating the spend journal, due to +// the fact that there is not a trivial or efficient way to resurrect the spent +// txout flags that were previously only stored when the spent txout was the +// final unspent output of the containing transaction. +// // The serialized format is: // // [