diff --git a/src/api/handlers.rs b/src/api/handlers.rs index 9d52aa9..7bcc3e1 100644 --- a/src/api/handlers.rs +++ b/src/api/handlers.rs @@ -516,38 +516,45 @@ pub async fn post_import_keypairs( pub async fn post_make_payment( db: WalletDb, peer: Node, - encapsulated_data: EncapsulatedPayment, + encapsulated_data: Vec, route: &'static str, call_id: String, ) -> Result { - let EncapsulatedPayment { - address, - amount, - passphrase, - locktime, - } = encapsulated_data; - let r = CallResponse::new(route, &call_id); + let mut addresses = Vec::new(); + let mut amounts = Vec::new(); - let request = match db.test_passphrase(passphrase).await { - Ok(_) => UserRequest::UserApi(UserApiRequest::MakePayment { - address: address.clone(), + for ed in encapsulated_data { + let EncapsulatedPayment { + address, amount, + passphrase, locktime, - }), - Err(e) => { - return wallet_db_error(e, r); - } - }; + } = ed; + + let request = match db.test_passphrase(passphrase).await { + Ok(_) => UserRequest::UserApi(UserApiRequest::MakePayment { + address: address.clone(), + amount, + locktime, + }), + Err(e) => { + return wallet_db_error(e, r); + } + }; - if let Err(e) = peer.inject_next_event(peer.local_address(), request) { - error!("route:make_payment error: {:?}", e); - return r.into_err_internal(ApiErrorType::CannotAccessUserNode); + addresses.push(address); + amounts.push(amount); + + if let Err(e) = peer.inject_next_event(peer.local_address(), request) { + error!("route:make_payment error: {:?}", e); + return r.into_err_internal(ApiErrorType::CannotAccessUserNode); + } } r.into_ok( "Payment processing", - json_serialize_embed(construct_make_payment_map(address, amount)), + json_serialize_embed(construct_make_payment_map(&addresses, &amounts)), ) } @@ -593,7 +600,7 @@ pub async fn post_make_ip_payment( r.into_ok( "IP payment processing", - json_serialize_embed(construct_make_payment_map(address.clone(), amount)), + json_serialize_embed(construct_make_payment_map(&vec![address.clone()], &vec![amount])), ) } @@ -1148,10 +1155,14 @@ pub fn construct_ctx_map(transactions: &[Transaction]) -> BTreeMap BTreeMap { let mut tx_info = BTreeMap::new(); - tx_info.insert(to_address, APIAsset::new(Asset::Token(amount), None)); + + for (to_address, amount) in to_address.iter().zip(amount.iter()) { + tx_info.insert(to_address.clone(), APIAsset::new(Asset::Token(amount.clone()), None)); + } + tx_info } diff --git a/src/bin/node_settings_aws.toml b/src/bin/node_settings_aws.toml index c2b7c90..0275099 100644 --- a/src/bin/node_settings_aws.toml +++ b/src/bin/node_settings_aws.toml @@ -1,29 +1,45 @@ -mempool_db_mode = {Live = 0} -storage_db_mode = {Live = 0} -miner_db_mode = {Live = 0} -user_db_mode = {Live = 0} -api_port = 3000 +mempool_db_mode = { Test = 0 } +storage_db_mode = { Test = 0 } +miner_db_mode = { Live = 0 } +user_db_mode = { Live = 1000 } +user_api_port = 3000 +storage_api_port = 3001 +mempool_api_port = 3003 +miner_api_port = 3004 mempool_raft = 1 storage_raft = 1 -storage_block_timeout = 60000 mempool_partition_full_size = 1 mempool_minimum_miner_pool_len = 1 jurisdiction = "US" +backup_block_modulo = 4 +peer_limit = 1000 +mempool_mining_event_timeout= 30000 +storage_block_timeout = 30000 +#backup_restore = true +enable_trigger_messages_pipeline_reset = true [mempool_unicorn_fixed_param] modulus = "6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151" -iterations = 1_000 +iterations = 2 security = 1 +[user_test_auto_gen_setup] +user_setup_tx_chunk_size = 5 +user_setup_tx_in_per_tx = 3 +user_setup_tx_max_count = 100000 + #first node is leader [[mempool_nodes]] -address = "44.239.251.56:12300" +address = "34.65.95.17:8116" [[storage_nodes]] -address = "52.40.82.170:8080" +address = "https://storage.aiblock.dev" [[miner_nodes]] -address = "52.27.248.13:12340" +address = "127.0.0.1:12390" [[user_nodes]] -address = "35.155.18.122:12342" +address = "127.0.0.1:12370" + +#[[user_nodes]] +#"address"="127.0.0.1:12361"