mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-02-16 00:23:56 +00:00
[NOD-1320] Flush UTXOs to disk (#902)
* [NOD-1320] Flush UTXOs to disk. * [NOD-1320] Minor improvements and fixes. * FullUTXOSet: change size type from int64 to uint64. * Rename FullUTXOSet.size to FullUTXOSet.estimatedSize * Fill NewFullUTXOSetFromContext with db context on virtual block creation. * Typo fixes. * [NOD-1320] Stylystic fixes. * [NOD-1320] Update tests. Improvements and fixes. * Update blockdag/dag tests: prepare DB for tests. * Update blockdag/utxoset tests: prepare DB for tests. * Update blockdag/test_utils utils. * Update blockdag/common tests. * FullUTXOSet: remove embedded utxoCollection type. Rename utxoCollection to utxoCache. * Fix blockdag/block_utxo genesisPastUTXO func. * Minor fixes and improvements.
This commit is contained in:
@@ -36,6 +36,18 @@ func RemoveFromUTXOSet(context Context, outpointKey []byte) error {
|
||||
return accessor.Delete(key)
|
||||
}
|
||||
|
||||
// GetFromUTXOSet return the given outpoint from the
|
||||
// database's UTXO set.
|
||||
func GetFromUTXOSet(context Context, outpointKey []byte) ([]byte, error) {
|
||||
accessor, err := context.accessor()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
key := utxoKey(outpointKey)
|
||||
return accessor.Get(key)
|
||||
}
|
||||
|
||||
// UTXOSetCursor opens a cursor over all the UTXO entries
|
||||
// that have been previously added to the database.
|
||||
func UTXOSetCursor(context Context) (database.Cursor, error) {
|
||||
|
||||
Reference in New Issue
Block a user