diff --git a/src/main/kotlin/io/openfuture/chain/rpc/controller/transaction/TransferTransactionController.kt b/src/main/kotlin/io/openfuture/chain/rpc/controller/transaction/TransferTransactionController.kt index 2ad31aa3..d3586e2a 100644 --- a/src/main/kotlin/io/openfuture/chain/rpc/controller/transaction/TransferTransactionController.kt +++ b/src/main/kotlin/io/openfuture/chain/rpc/controller/transaction/TransferTransactionController.kt @@ -39,6 +39,15 @@ class TransferTransactionController( fun add(@Valid @RequestBody request: TransferTransactionRequest): TransferTransactionResponse = TransferTransactionResponse(transactionManager.add(UnconfirmedTransferTransaction.of(request))) + @PostMapping("batch") + fun addBatch(@Valid @RequestBody requests: List): Int{ + for (request in requests){ + transactionManager.add(UnconfirmedTransferTransaction.of(request)) + } + return requests.size + } + + @CrossOrigin @GetMapping fun getAll(@Valid request: TransactionPageRequest): PageResponse = diff --git a/src/main/resources/application-chain-1.properties b/src/main/resources/application-chain-1.properties index b9b5b9c2..27df89af 100644 --- a/src/main/resources/application-chain-1.properties +++ b/src/main/resources/application-chain-1.properties @@ -1,9 +1,10 @@ # DATABASE -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3308/chain_1?allowPublicKeyRetrieval=true&useSSL=false +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.url=jdbc:h2:./db/chain_1;NON_KEYWORDS=value,key,blocks,timestamp;DATABASE_TO_UPPER=false;FILE_LOCK=NO;LOCK_TIMEOUT=10000;DB_CLOSE_DELAY=-1;MODE=MYSQL +spring.jpa.open-in-view=true +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.username=root spring.datasource.password=123456 -spring.jpa.open-in-view=true # Logging logging.level.io.openfuture.chain=INFO diff --git a/src/main/resources/application-chain-2.properties b/src/main/resources/application-chain-2.properties index 81b81463..44b3092f 100644 --- a/src/main/resources/application-chain-2.properties +++ b/src/main/resources/application-chain-2.properties @@ -1,9 +1,10 @@ # DATABASE -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3308/chain_2?allowPublicKeyRetrieval=true&useSSL=false +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.url=jdbc:h2:./db/chain_2;NON_KEYWORDS=value,key,blocks,timestamp;DATABASE_TO_UPPER=false;FILE_LOCK=NO;LOCK_TIMEOUT=10000;DB_CLOSE_DELAY=-1;MODE=MYSQL +spring.jpa.open-in-view=true +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.username=root spring.datasource.password=123456 -spring.jpa.open-in-view=true # Logging logging.level.io.openfuture.chain=INFO diff --git a/src/main/resources/application-chain-3.properties b/src/main/resources/application-chain-3.properties index 606deb44..bd419c8d 100644 --- a/src/main/resources/application-chain-3.properties +++ b/src/main/resources/application-chain-3.properties @@ -1,9 +1,10 @@ # DATABASE -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3308/chain_3?allowPublicKeyRetrieval=true&useSSL=false +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.url=jdbc:h2:./db/chain_3;NON_KEYWORDS=value,key,blocks,timestamp;DATABASE_TO_UPPER=false;FILE_LOCK=NO;LOCK_TIMEOUT=10000;DB_CLOSE_DELAY=-1;MODE=MYSQL +spring.jpa.open-in-view=true +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.username=root spring.datasource.password=123456 -spring.jpa.open-in-view=true # Logging logging.level.io.openfuture.chain=INFO diff --git a/src/main/resources/application-chain-4.properties b/src/main/resources/application-chain-4.properties index c80d2307..0164c71e 100644 --- a/src/main/resources/application-chain-4.properties +++ b/src/main/resources/application-chain-4.properties @@ -1,9 +1,10 @@ # DATABASE -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3308/chain_4?allowPublicKeyRetrieval=true&useSSL=false +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.url=jdbc:h2:./db/chain_4;NON_KEYWORDS=value,key,blocks,timestamp;DATABASE_TO_UPPER=false;FILE_LOCK=NO;LOCK_TIMEOUT=10000;DB_CLOSE_DELAY=-1;MODE=MYSQL +spring.jpa.open-in-view=true +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.username=root spring.datasource.password=123456 -spring.jpa.open-in-view=true # Logging logging.level.io.openfuture.chain=INFO diff --git a/src/main/resources/application-chain-5.properties b/src/main/resources/application-chain-5.properties index f5c89067..bb804057 100644 --- a/src/main/resources/application-chain-5.properties +++ b/src/main/resources/application-chain-5.properties @@ -1,9 +1,10 @@ # DATABASE -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3308/chain_5?allowPublicKeyRetrieval=true&useSSL=false +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.url=jdbc:h2:./db/chain_5;NON_KEYWORDS=value,key,blocks,timestamp;DATABASE_TO_UPPER=false;FILE_LOCK=NO;LOCK_TIMEOUT=10000;DB_CLOSE_DELAY=-1;MODE=MYSQL +spring.jpa.open-in-view=true +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.username=root spring.datasource.password=123456 -spring.jpa.open-in-view=true # Logging logging.level.io.openfuture.chain=INFO diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 7fbb96a0..2b56e35b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -34,8 +34,8 @@ node.ntp-offset-threshold=100 consensus.epoch-height=21 consensus.delegates-count=21 consensus.block-capacity=10000 -consensus.time-slot-duration=50000 -consensus.time-slot-interval=15000 +consensus.time-slot-duration=5000 +consensus.time-slot-interval=1500 consensus.genesis-address=0x0000000000000000000000000000000000000000 consensus.reward-block=10 consensus.fee-vote-tx-for=3