storage: remove redundant encoding version column
This commit is contained in:
@@ -32,7 +32,6 @@ func CreateTables(conn *sql.DB) error {
|
|||||||
height INTEGER PRIMARY KEY,
|
height INTEGER PRIMARY KEY,
|
||||||
hash TEXT,
|
hash TEXT,
|
||||||
has_sapling_tx BOOL,
|
has_sapling_tx BOOL,
|
||||||
encoding_version INTEGER,
|
|
||||||
compact_encoding BLOB
|
compact_encoding BLOB
|
||||||
);
|
);
|
||||||
`
|
`
|
||||||
@@ -135,9 +134,9 @@ func GetBlockRange(conn *sql.DB, start, end int) ([]*rpc.CompactBlock, error) {
|
|||||||
return compactBlocks, nil
|
return compactBlocks, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func StoreBlock(conn *sql.DB, height int, hash string, sapling bool, version int, encoded []byte) error {
|
func StoreBlock(conn *sql.DB, height int, hash string, sapling bool, encoded []byte) error {
|
||||||
insertBlock := "INSERT INTO blocks (height, hash, has_sapling_tx, encoding_version, compact_encoding) values (?, ?, ?, ?, ?)"
|
insertBlock := "INSERT INTO blocks (height, hash, has_sapling_tx, compact_encoding) values (?, ?, ?, ?)"
|
||||||
_, err := conn.Exec(insertBlock, height, hash, sapling, version, encoded)
|
_, err := conn.Exec(insertBlock, height, hash, sapling, encoded)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, fmt.Sprintf("storing compact block %d", height))
|
return errors.Wrap(err, fmt.Sprintf("storing compact block %d", height))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,10 +58,9 @@ func TestSqliteStorage(t *testing.T) {
|
|||||||
hash := hex.EncodeToString(block.GetEncodableHash())
|
hash := hex.EncodeToString(block.GetEncodableHash())
|
||||||
hasSapling := block.HasSaplingTransactions()
|
hasSapling := block.HasSaplingTransactions()
|
||||||
protoBlock := block.ToCompact()
|
protoBlock := block.ToCompact()
|
||||||
version := 1
|
|
||||||
marshaled, _ := protobuf.Marshal(protoBlock)
|
marshaled, _ := protobuf.Marshal(protoBlock)
|
||||||
|
|
||||||
err = StoreBlock(conn, height, hash, hasSapling, version, marshaled)
|
err = StoreBlock(conn, height, hash, hasSapling, marshaled)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user