OSDN Git Service

updata TestFilterAccountUtxo
authorChengcheng Zhang <943420582@qq.com>
Mon, 8 Jul 2019 03:32:05 +0000 (11:32 +0800)
committerChengcheng Zhang <943420582@qq.com>
Mon, 8 Jul 2019 03:32:05 +0000 (11:32 +0800)
database/leveldb/db.go
wallet/utxo_test.go

index 485ab23..46c0b05 100644 (file)
@@ -39,13 +39,16 @@ type Iterator interface {
 //-----------------------------------------------------------------------------
 
 const (
-       utxoPrefix  byte = iota //UTXOPrefix is StandardUTXOKey prefix
-       sutxoPrefix             //SUTXOPrefix is ContractUTXOKey prefix
+       utxoPrefix byte = iota //UTXOPrefix is StandardUTXOKey prefix
        contractPrefix
        contractIndexPrefix
        accountPrefix // AccountPrefix is account ID prefix
-       accountAliasPrefix
        accountIndexPrefix
+)
+
+const (
+       sutxoPrefix byte = iota //SUTXOPrefix is ContractUTXOKey prefix
+       accountAliasPrefix
        txPrefix            //TxPrefix is wallet database transactions prefix
        txIndexPrefix       //TxIndexPrefix is wallet database tx index prefix
        unconfirmedTxPrefix //UnconfirmedTxPrefix is txpool unconfirmed transactions prefix
@@ -59,24 +62,26 @@ const (
 // leveldb key prefix
 var (
        colon               byte = 0x3a
-       store                    = []byte("store:")
        accountStore             = []byte("AS:")
-       walletStore              = []byte("WS:")
        UTXOPrefix               = append(accountStore, utxoPrefix, colon)
-       SUTXOPrefix              = append(walletStore, sutxoPrefix, colon)
        ContractPrefix           = append(accountStore, contractPrefix, colon)
        ContractIndexPrefix      = append(accountStore, contractIndexPrefix, colon)
        AccountPrefix            = append(accountStore, accountPrefix, colon) // AccountPrefix is account ID prefix
-       AccountAliasPrefix       = append(walletStore, accountAliasPrefix, colon)
        AccountIndexPrefix       = append(accountStore, accountIndexPrefix, colon)
-       TxPrefix                 = append(walletStore, txPrefix, colon)            //TxPrefix is wallet database transactions prefix
-       TxIndexPrefix            = append(walletStore, txIndexPrefix, colon)       //TxIndexPrefix is wallet database tx index prefix
-       UnconfirmedTxPrefix      = append(walletStore, unconfirmedTxPrefix, colon) //UnconfirmedTxPrefix is txpool unconfirmed transactions prefix
-       GlobalTxIndexPrefix      = append(walletStore, globalTxIndexPrefix, colon) //GlobalTxIndexPrefix is wallet database global tx index prefix
-       WalletKey                = append(walletStore, walletKey)
-       MiningAddressKey         = append(walletStore, miningAddressKey)
-       CoinbaseAbKey            = append(walletStore, coinbaseAbKey)
-       RecoveryKey              = append(walletStore, recoveryKey)
+)
+
+var (
+       walletStore         = []byte("WS:")
+       SUTXOPrefix         = append(walletStore, sutxoPrefix, colon)
+       AccountAliasPrefix  = append(walletStore, accountAliasPrefix, colon)
+       TxPrefix            = append(walletStore, txPrefix, colon)            //TxPrefix is wallet database transactions prefix
+       TxIndexPrefix       = append(walletStore, txIndexPrefix, colon)       //TxIndexPrefix is wallet database tx index prefix
+       UnconfirmedTxPrefix = append(walletStore, unconfirmedTxPrefix, colon) //UnconfirmedTxPrefix is txpool unconfirmed transactions prefix
+       GlobalTxIndexPrefix = append(walletStore, globalTxIndexPrefix, colon) //GlobalTxIndexPrefix is wallet database global tx index prefix
+       WalletKey           = append(walletStore, walletKey)
+       MiningAddressKey    = append(walletStore, miningAddressKey)
+       CoinbaseAbKey       = append(walletStore, coinbaseAbKey)
+       RecoveryKey         = append(walletStore, recoveryKey)
 )
 
 const (
index a446722..57773bc 100644 (file)
@@ -230,7 +230,7 @@ func TestFilterAccountUtxo(t *testing.T) {
                },
                {
                        dbPrograms: map[string]*account.CtrlProgram{
-                               "41533a023a2a37a64a4e15a772ab43bf3f5956d0d1f353946496788e7f40d0ff1796286a6f": &account.CtrlProgram{
+                               "41533a013a2a37a64a4e15a772ab43bf3f5956d0d1f353946496788e7f40d0ff1796286a6f": &account.CtrlProgram{
                                        AccountID: "testAccount",
                                        Address:   "testAddress",
                                        KeyIndex:  53,
@@ -290,13 +290,13 @@ func TestFilterAccountUtxo(t *testing.T) {
                },
                {
                        dbPrograms: map[string]*account.CtrlProgram{
-                               "41533a023a2a37a64a4e15a772ab43bf3f5956d0d1f353946496788e7f40d0ff1796286a6f": &account.CtrlProgram{
+                               "41533a013a2a37a64a4e15a772ab43bf3f5956d0d1f353946496788e7f40d0ff1796286a6f": &account.CtrlProgram{
                                        AccountID: "testAccount",
                                        Address:   "testAddress",
                                        KeyIndex:  53,
                                        Change:    true,
                                },
-                               "41533a023adb4d86262c12ba70d50b3ca3ae102d5682436243bd1e8c79569603f75675036a": &account.CtrlProgram{
+                               "41533a013adb4d86262c12ba70d50b3ca3ae102d5682436243bd1e8c79569603f75675036a": &account.CtrlProgram{
                                        AccountID: "testAccount2",
                                        Address:   "testAddress2",
                                        KeyIndex:  72,