Skip to content

Commit

Permalink
chore: remove unused COLUMN_BLOCK_TRANSACTION_IDS column
Browse files Browse the repository at this point in the history
  • Loading branch information
quake committed Apr 10, 2019
1 parent f5b8a01 commit 7901f50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
1 change: 0 additions & 1 deletion shared/src/lib.rs
Expand Up @@ -33,5 +33,4 @@ pub const COLUMN_META: Col = Some(4);
pub const COLUMN_TRANSACTION_ADDR: Col = Some(5);
pub const COLUMN_EXT: Col = Some(7);
pub const COLUMN_BLOCK_TRANSACTION_ADDRESSES: Col = Some(9);
pub const COLUMN_BLOCK_TRANSACTION_IDS: Col = Some(10);
pub const COLUMN_BLOCK_PROPOSAL_IDS: Col = Some(11);
17 changes: 3 additions & 14 deletions shared/src/store.rs
@@ -1,8 +1,7 @@
use crate::flat_serializer::{serialize as flat_serialize, Address};
use crate::{
COLUMN_BLOCK_BODY, COLUMN_BLOCK_HEADER, COLUMN_BLOCK_PROPOSAL_IDS,
COLUMN_BLOCK_TRANSACTION_ADDRESSES, COLUMN_BLOCK_TRANSACTION_IDS, COLUMN_BLOCK_UNCLE,
COLUMN_EXT,
COLUMN_BLOCK_TRANSACTION_ADDRESSES, COLUMN_BLOCK_UNCLE, COLUMN_EXT,
};
use bincode::{deserialize, serialize};
use ckb_core::block::{Block, BlockBuilder};
Expand Down Expand Up @@ -174,34 +173,24 @@ impl<T: 'static + KeyValueDB> ChainStore for ChainKVStore<T> {

fn insert_block(&self, batch: &mut Batch, b: &Block) {
let hash = b.header().hash().to_vec();
let txs_ids = b
.commit_transactions()
.iter()
.map(|tx| tx.hash())
.collect::<Vec<H256>>();
batch.insert(
COLUMN_BLOCK_HEADER,
hash.clone(),
serialize(b.header()).expect("serializing header should be ok"),
);
let (block_data, block_addresses) = flat_serialize(b.commit_transactions().iter()).unwrap();
batch.insert(
COLUMN_BLOCK_TRANSACTION_IDS,
hash.clone(),
serialize(&txs_ids).expect("serializing txs hash should be ok"),
);
batch.insert(
COLUMN_BLOCK_UNCLE,
hash.clone(),
serialize(b.uncles()).expect("serializing uncles should be ok"),
);
batch.insert(COLUMN_BLOCK_BODY, hash.clone(), block_data);
batch.insert(
COLUMN_BLOCK_PROPOSAL_IDS,
hash.clone(),
serialize(b.proposal_transactions())
.expect("serializing proposal_transactions should be ok"),
);
let (block_data, block_addresses) = flat_serialize(b.commit_transactions().iter()).unwrap();
batch.insert(COLUMN_BLOCK_BODY, hash.clone(), block_data);
batch.insert(
COLUMN_BLOCK_TRANSACTION_ADDRESSES,
hash,
Expand Down

0 comments on commit 7901f50

Please sign in to comment.