Skip to content

Commit 7f432f1

Browse files
committed
testing blacklist
1 parent 58e99dc commit 7f432f1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

chain/open-block/src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use starcoin_types::{
2323
},
2424
U256,
2525
};
26+
use std::str::FromStr;
2627
use std::{convert::TryInto, sync::Arc};
2728

2829
pub struct OpenedBlock {
@@ -296,10 +297,15 @@ impl OpenedBlock {
296297
}
297298
}
298299
pub struct AddressFilter;
300+
static BLACKLIST: [&str; 2] = ["0x5d3729704311db3ac10ee04d08054543","0xda507619aedef9755faf2111cd63d3c5"];
299301
impl AddressFilter {
300-
const BLACKLIST: Vec<AccountAddress> = vec![]; //TODO: Fill in
301-
const ACTIVATION_BLOCK_NUMBER: BlockNumber = 16801958;
302+
const ACTIVATION_BLOCK_NUMBER: BlockNumber = 10;
302303
pub fn is_blacklisted(raw_txn: &SignedUserTransaction, block_number: BlockNumber) -> bool {
303-
block_number > Self::ACTIVATION_BLOCK_NUMBER && Self::BLACKLIST.contains(&raw_txn.sender())
304+
let blacklist: Vec<AccountAddress> = BLACKLIST
305+
.iter()
306+
.map(|&s| AccountAddress::from_str(s).expect("account address decode must success"))
307+
.collect();
308+
309+
block_number > Self::ACTIVATION_BLOCK_NUMBER && blacklist.contains(&raw_txn.sender())
304310
}
305311
}

0 commit comments

Comments
 (0)