OSDN Git Service

Revert "delete the crazy log"
[bytom/vapor.git] / database / store_test.go
index e9d7527..ea009eb 100644 (file)
@@ -169,10 +169,12 @@ func TestSaveChainStatus(t *testing.T) {
                        bc.Hash{V0: 1, V1: 1, V2: 3, V3: 4}: &storage.UtxoEntry{Type: storage.NormalUTXOType, BlockHeight: 100, Spent: true},
                        bc.Hash{V0: 1, V1: 1, V2: 3, V3: 5}: &storage.UtxoEntry{Type: storage.CrosschainUTXOType, BlockHeight: 100, Spent: false},
                        bc.Hash{V0: 1, V1: 1, V2: 3, V3: 6}: &storage.UtxoEntry{Type: storage.CrosschainUTXOType, BlockHeight: 100, Spent: true},
+                       bc.Hash{V0: 1, V1: 3, V2: 3, V3: 7}: &storage.UtxoEntry{Type: storage.VoteUTXOType, BlockHeight: 100, Spent: false},
+                       bc.Hash{V0: 1, V1: 3, V2: 3, V3: 7}: &storage.UtxoEntry{Type: storage.VoteUTXOType, BlockHeight: 100, Spent: true},
                },
        }
 
-       if err := store.SaveChainStatus(node, node, view, map[uint64]*state.VoteResult{}); err != nil {
+       if err := store.SaveChainStatus(node, node, view, []*state.VoteResult{}); err != nil {
                t.Fatal(err)
        }
 
@@ -188,6 +190,9 @@ func TestSaveChainStatus(t *testing.T) {
                if (utxo.Type == storage.CrosschainUTXOType) && (!utxo.Spent) {
                        continue
                }
+               if (utxo.Type == storage.VoteUTXOType) && (utxo.Spent) {
+                       continue
+               }
 
                gotUtxo, err := store.GetUtxo(&hash)
                if err != nil {
@@ -216,7 +221,7 @@ func TestSaveBlock(t *testing.T) {
        }
 
        blockHash := block.Hash()
-       gotBlock, err := store.GetBlock(&blockHash)
+       gotBlock, err := store.GetBlock(&blockHash, block.Height)
        if err != nil {
                t.Fatal(err)
        }