-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bug fix] Solved the problem that when the indexer parses txn info wi…
…thout transaction, it reports an error and exits, resulting in the block not being added to ES storage
- Loading branch information
Showing
11 changed files
with
103 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
starcoin-indexer/src/test/java/org/starcoin/indexer/test/IndexerLogicBaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
starcoin-indexer/src/test/java/org/starcoin/indexer/utils/ServiceUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.starcoin.indexer.utils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.starcoin.api.TransactionRPCClient; | ||
import org.starcoin.bean.Block; | ||
import org.starcoin.bean.BlockHeader; | ||
import org.starcoin.indexer.handler.ServiceUtils; | ||
import org.starcoin.indexer.test.IndexerLogicBaseTest; | ||
import org.starcoin.utils.ExceptionWrap; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class ServiceUtilsTest extends IndexerLogicBaseTest { | ||
|
||
@Autowired | ||
private TransactionRPCClient transactionRPCClient; | ||
|
||
@Test | ||
void testFetchTransactionsForBlock() { | ||
List<String> blockHashes = Arrays.asList( | ||
"0x6590d6769e9837e5fbc116daf53efa809f996e16cf55d4a713695094ac79aada", | ||
"0x6b7ca9e9a1aa3f414caab285f214179108d5cf3fc2864efd9e7b5ed4461e7e80", | ||
"0x042218a4750e696942fab2a875479a77f7c3c48049acb400a80c77b24aa06d36", | ||
"0x721c15b57a22687dd90a439d85918f92f49937eef48c7c7afb72a7da43845589", | ||
"0x9a68fd546aec8fdad955c0626cb9b20be121f932bb69f8a523f029248b125f51", | ||
"0x73c0d5b604e130dedf0ecb77102e91de521bf38097b80d3e64c7ed58bc85c232", | ||
"0x9161c9b51a7817cc2a18c190c99b40e96cb7cf4666ad63a7ffa33b2671c3aa31", | ||
"0x020aadcabfbd57cc4c9059d16a91f8bc944b6c5c110d4fc72e6c346658035ecc" | ||
); | ||
List<Block> blocks = blockHashes.stream().map(ExceptionWrap.wrap(blockHash -> { | ||
Block block = new Block(); | ||
BlockHeader header = new BlockHeader(); | ||
header.setBlockHash(blockHash); | ||
block.setHeader(header); | ||
ServiceUtils.fetchTransactionsForBlock(transactionRPCClient, block); | ||
System.out.println("Block: " + blockHash); | ||
return block; | ||
})).collect(Collectors.toList()); | ||
blocks.forEach(System.out::println); | ||
|
||
} | ||
} |
35 changes: 19 additions & 16 deletions
35
starcoin-indexer/src/test/resources/application-integrationtest.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
# server.port=8300 | ||
starcoin.seeds=${HOSTS} | ||
starcoin.network=${NETWORK} | ||
starcoin.bg_task.jobs=${BG_TASK_JOBS} | ||
starcoin.indexer.bulk_size=${BULK_SIZE} | ||
starcoin.indexer.txn_offset=${TXN_OFFSET} | ||
starcoin.seeds=vega.seed.starcoin.org | ||
starcoin.network=vega | ||
starcoin.bg_task.jobs= | ||
starcoin.indexer.bulk_size=100 | ||
starcoin.indexer.txn_offset=0 | ||
jasypt.encryptor.bean=encryptorBean | ||
jasypt.encryptor.password=${STARCOIN_ES_PWD} | ||
elasticsearch.host=${STARCOIN_ES_URL} | ||
elasticsearch.protocol=${STARCOIN_ES_PROTOCOL} | ||
elasticsearch.port=${STARCOIN_ES_PORT} | ||
elasticsearch.username=${STARCOIN_ES_USER} | ||
jasypt.encryptor.password= | ||
elasticsearch.host=localhost | ||
elasticsearch.protocol=http | ||
elasticsearch.port=9200 | ||
elasticsearch.username= | ||
elasticsearch.connTimeout=10000 | ||
elasticsearch.socketTimeout=10000 | ||
elasticsearch.connectionRequestTimeout=2000 | ||
swap.contract.address=${SWAP_CONTRACT_ADDR} | ||
starcoin.swap.api.url=${SWAP_API_URL} | ||
swap.contract.address=0x8c109349c6bd91411d6bc962e080c4a3 | ||
starcoin.swap.api.url=https://swap-api.starswap.xyz | ||
logging.file.name=logs/indexer.log | ||
|
||
## Unittest config | ||
spring.profiles=unittest | ||
spring.datasource.hikari.minimum-idle=1 | ||
spring.datasource.hikari.maximum-pool-size=2 | ||
spring.datasource.url=${DS_URL} | ||
spring.datasource.username=${DB_USER_NAME} | ||
spring.datasource.password=${DB_PWD} | ||
spring.jpa.properties.hibernate.default_schema=${DB_SCHEMA} | ||
spring.datasource.url=jdbc:postgresql://localhost/starcoin | ||
spring.datasource.username=starcoin | ||
spring.datasource.password=starcoin | ||
spring.jpa.properties.hibernate.default_schema=vega |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
STARCOIN_ES_URL=localhost | ||
STARCOIN_ES_PROTOCOL=http | ||
STARCOIN_ES_PORT=9200 | ||
STARCOIN_ES_USER= | ||
STARCOIN_ES_INDEX_VERSION= | ||
STARCOIN_ES_PWD= | ||
MAIN_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=main | ||
BARNARD_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=barnard | ||
HALLEY_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=halley | ||
DS_URL=jdbc:postgresql://localhost/starcoin | ||
STARCOIN_USER_DS_URL="jdbc:postgresql://localhost/starcoin?currentSchema=starcoin_user" | ||
DB_USER_NAME=starcoin | ||
DB_PWD=starcoin |