8
8
)
9
9
10
10
func overwriteUTXOsWithLookUp (utxos []types.UTXO ) error {
11
+ common .DebugLogger .Println ("overwriting utxos with lookup" )
11
12
var utxosToOverwrite []types.UTXO
12
13
13
14
for _ , utxo := range utxos {
@@ -35,7 +36,7 @@ func overwriteUTXOsWithLookUp(utxos []types.UTXO) error {
35
36
common .ErrorLogger .Println (err )
36
37
return err
37
38
}
38
- _ = key
39
+
39
40
err = dblevel .PruneUTXOs (key [:64 ])
40
41
if err != nil {
41
42
common .ErrorLogger .Println (err )
@@ -52,6 +53,7 @@ func overwriteUTXOsWithLookUp(utxos []types.UTXO) error {
52
53
53
54
// todo construct the subsequent deletion of all utxos per transaction once all per transaction are spent
54
55
func markSpentUTXOsAndTweaks (utxos []types.UTXO ) error {
56
+ common .DebugLogger .Println ("marking utxos" )
55
57
if len (utxos ) == 0 {
56
58
if common .Chain == common .Mainnet {
57
59
// no warnings on other chains as it is very likely to not have any taproot outputs for several blocks on end
@@ -105,9 +107,13 @@ func markSpentUTXOsAndTweaks(utxos []types.UTXO) error {
105
107
common .ErrorLogger .Println (err )
106
108
return err
107
109
} else if err != nil && errors .Is (err , dblevel.NoEntryErr {}) {
108
- // this case should not even occur at this stage as utxos are not deleted before this query and are only marked as spent
109
- common .DebugLogger .Printf ("txid: %s\n " , utxo .Txid )
110
- common .DebugLogger .Println ("no UTXOs were found for transaction" )
110
+ // utxos can be already deleted at this point.
111
+ // all utxos gone means we can remove the tweak
112
+ tweaksToDelete = append (tweaksToDelete , types.Tweak {
113
+ // we only need those Fields to serialise the key
114
+ BlockHash : utxo .BlockHash ,
115
+ Txid : utxo .Txid ,
116
+ })
111
117
continue
112
118
}
113
119
var canBeRemoved = true
@@ -124,8 +130,8 @@ func markSpentUTXOsAndTweaks(utxos []types.UTXO) error {
124
130
Txid : utxo .Txid ,
125
131
})
126
132
continue
127
-
128
133
}
134
+
129
135
var newBiggest * uint64
130
136
newBiggest , err = types .FindBiggestRemainingUTXO (utxo , remainingUTXOs )
131
137
if err != nil {
0 commit comments