|
|
@ -233,16 +233,23 @@ func (utxoPool *UTXOPool) DeleteOneBalanceItem(address, txID string, index int) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CleanUp cleans up UTXOPool.
|
|
|
|
// CleanUp cleans up UTXOPool.
|
|
|
|
// func (utxoPool *UTXOPool) CleanUp() string {
|
|
|
|
func (utxoPool *UTXOPool) CleanUp() { |
|
|
|
// for address, txMap := range utxoPool.UtxoMap {
|
|
|
|
for address, txMap := range utxoPool.UtxoMap { |
|
|
|
// for txid, outIndexes := range txMap {
|
|
|
|
for txid, outIndexes := range txMap { |
|
|
|
// if len(outIndexes) == 0 {
|
|
|
|
for index, value := range outIndexes { |
|
|
|
// utxoPool.UtxoMap[address] = delete(utxoPool.UtxoMap[address], txid)
|
|
|
|
if value == 0 { |
|
|
|
// }
|
|
|
|
delete(utxoPool.UtxoMap[address][txid], index) |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// return res
|
|
|
|
if len(utxoPool.UtxoMap[address][txid]) == 0 { |
|
|
|
// }
|
|
|
|
delete(utxoPool.UtxoMap[address], txid) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if len(utxoPool.UtxoMap[address]) == 0 { |
|
|
|
|
|
|
|
delete(utxoPool.UtxoMap, address) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Used for debugging.
|
|
|
|
// Used for debugging.
|
|
|
|
func (utxoPool *UTXOPool) String() string { |
|
|
|
func (utxoPool *UTXOPool) String() string { |
|
|
|