Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
testing blacklist
  • Loading branch information
sanlee42 committed Mar 7, 2024
1 parent 09d21fc commit 29845e9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions chain/open-block/src/lib.rs
Expand Up @@ -23,6 +23,7 @@ use starcoin_types::{
},
U256,
};
use std::str::FromStr;
use std::{convert::TryInto, sync::Arc};

pub struct OpenedBlock {
Expand Down Expand Up @@ -296,10 +297,15 @@ impl OpenedBlock {
}
}
pub struct AddressFilter;
static BLACKLIST: [&str; 2] = ["0x5d3729704311db3ac10ee04d08054543","0xda507619aedef9755faf2111cd63d3c5"];
impl AddressFilter {
const BLACKLIST: Vec<AccountAddress> = vec![]; //TODO: Fill in
const ACTIVATION_BLOCK_NUMBER: BlockNumber = 16801958;
const ACTIVATION_BLOCK_NUMBER: BlockNumber = 10;
pub fn is_blacklisted(raw_txn: &SignedUserTransaction, block_number: BlockNumber) -> bool {
block_number > Self::ACTIVATION_BLOCK_NUMBER && Self::BLACKLIST.contains(&raw_txn.sender())
let blacklist: Vec<AccountAddress> = BLACKLIST
.iter()
.map(|&s| AccountAddress::from_str(s).expect("account address decode must success"))
.collect();

block_number > Self::ACTIVATION_BLOCK_NUMBER && blacklist.contains(&raw_txn.sender())
}
}

0 comments on commit 29845e9

Please sign in to comment.