// mergeUtxoView adds all of the entries in view to viewA. The result is that // viewA will contain all of its original entries plus all of the entries // in viewB. It will replace any entries in viewB which also exist in viewA // if the entry in viewA is fully spent. func mergeUtxoView(viewA *blockchain.UtxoViewpoint, viewB *blockchain.UtxoViewpoint) { viewAEntries := viewA.Entries() for hash, entryB := range viewB.Entries() { if entryA, exists := viewAEntries[hash]; !exists || entryA == nil || entryA.IsFullySpent() { viewAEntries[hash] = entryB } } }