Skip to content

Commit 1b36991

Browse files
committed
Reject overriding default txns SP parsers.
Signed-off-by: Sergey Minaev <[email protected]>
1 parent 6dedd3f commit 1b36991

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

libindy/src/services/pool/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ impl PoolService {
791791

792792
pub fn register_sp_parser(txn_type: &str,
793793
parser: CustomTransactionParser, free: CustomFree) -> Result<(), PoolError> {
794+
if transaction_handler::REQUESTS_FOR_STATE_PROOFS.contains(&txn_type) {
795+
return Err(PoolError::CommonError(CommonError::InvalidStructure(
796+
format!("Try to override StateProof parser for default TXN_TYPE {}", txn_type))));
797+
}
794798
REGISTERED_SP_PARSERS.lock()
795799
.map(|mut map| {
796800
map.insert(txn_type.to_owned(), (parser, free));

libindy/src/services/pool/transaction_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use services::ledger::merkletree::merkletree::MerkleTree;
3232
use services::pool::PoolService;
3333
use self::indy_crypto::bls::Generator;
3434

35-
const REQUESTS_FOR_STATE_PROOFS: [&'static str; 7] = [
35+
pub const REQUESTS_FOR_STATE_PROOFS: [&'static str; 7] = [
3636
constants::GET_NYM,
3737
constants::GET_SCHEMA,
3838
constants::GET_CRED_DEF,

0 commit comments

Comments
 (0)