Skip to content

Commit 9769065

Browse files
committed
Write WrapCCC tracker to db
1 parent fd0294f commit 9769065

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

core/src/blockchain/body_db.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::collections::{HashMap, HashSet};
1818
use std::mem;
1919
use std::sync::Arc;
2020

21-
use ctypes::transaction::ShardTransaction;
21+
use ctypes::transaction::{Action, AssetWrapCCCOutput, ShardTransaction, Transaction};
2222
use kvdb::{DBTransaction, KeyValueDB};
2323
use parking_lot::{Mutex, RwLock};
2424
use primitives::{Bytes, H256};
@@ -343,11 +343,34 @@ fn parcel_address_entries(
343343
}
344344

345345
fn transaction_address_entries(
346+
//check
346347
block_hash: H256,
347348
parcel_hashes: impl IntoIterator<Item = UnverifiedTransaction>,
348349
) -> impl Iterator<Item = TransactionHashAndAddress> {
349350
parcel_hashes.into_iter().enumerate().filter_map(move |(parcel_index, parcel)| {
350-
Option::<ShardTransaction>::from(parcel.action.clone()).map(|tx| {
351+
let shard_tx = match parcel.action.clone() {
352+
Action::WrapCCC {
353+
shard_id,
354+
lock_script_hash,
355+
parameters,
356+
quantity,
357+
..
358+
} => {
359+
let unsigned_tx: Transaction = parcel.into();
360+
Some(ShardTransaction::WrapCCC {
361+
network_id: unsigned_tx.network_id,
362+
shard_id,
363+
tx_hash: unsigned_tx.hash(),
364+
output: AssetWrapCCCOutput {
365+
lock_script_hash,
366+
parameters,
367+
quantity,
368+
},
369+
})
370+
}
371+
other_actions => Option::<ShardTransaction>::from(other_actions),
372+
};
373+
shard_tx.map(|tx| {
351374
(
352375
tx.tracker(),
353376
TransactionAddresses::new(TransactionAddress {

0 commit comments

Comments
 (0)