1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

fullnode: support for TCP master/slave replication

This commit is contained in:
ton 2019-09-19 23:15:32 +04:00
parent bfa166d66c
commit f40822b58a
50 changed files with 1109 additions and 244 deletions

View file

@ -33,10 +33,8 @@ class ClientKotlin {
@SmallTest
class TonTest {
val config = """{
"@type": "config.global",
"liteclients": [
"liteservers": [
{
"@type": "liteclient.config.global",
"ip": 1137658550,
"port": 4924,
"id": {
@ -44,7 +42,17 @@ class TonTest {
"key": "peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M="
}
}
]
],
"validator": {
"@type": "validator.config.global",
"zero_state": {
"workchain": -1,
"shard": -9223372036854775808,
"seqno": 0,
"root_hash": "VCSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=",
"file_hash": "eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo="
}
}
}"""
@Test
fun createTestWallet() {
@ -52,7 +60,7 @@ class TonTest {
val dir = getContext().getExternalFilesDir(null).toString() + "/";
runBlocking {
client.send(TonApi.Init(TonApi.Options(config, dir)))
val key = client.send(TonApi.CreateNewKey("local password".toByteArray(), "mnemonic password".toByteArray())) as TonApi.Key
val key = client.send(TonApi.CreateNewKey("local password".toByteArray(), "mnemonic password".toByteArray(), "".toByteArray())) as TonApi.Key
val walletAddress = client.send(TonApi.TestWalletGetAccountAddress(TonApi.TestWalletInitialAccountState(key.publicKey))) as TonApi.AccountAddress;
val testGiverState = client.send(TonApi.TestGiverGetAccountState()) as TonApi.TestGiverAccountState

View file

@ -54,21 +54,28 @@ public class TonTestJava {
}
}
String config =
"{" +
"\"@type\": \"config.global\"," +
"\"liteclients\": [" +
"{" +
"\"@type\": \"liteclient.config.global\"," +
"\"ip\": 1137658550," +
"\"port\": 4924," +
"\"id\": {" +
"\"@type\": \"pub.ed25519\"," +
"\"key\": \"peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M=\"" +
"}" +
"}" +
"]" +
"}";
String config = "{\n" +
" \"liteservers\": [\n" +
" {\n" +
" \"ip\": 1137658550,\n" +
" \"port\": 4924,\n" +
" \"id\": {\n" +
" \"@type\": \"pub.ed25519\",\n" +
" \"key\": \"peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M=\"\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"validator\": {\n" +
" \"@type\": \"validator.config.global\",\n" +
" \"zero_state\": {\n" +
" \"workchain\": -1,\n" +
" \"shard\": -9223372036854775808,\n" +
" \"seqno\": 0,\n" +
" \"root_hash\": \"VCSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=\",\n" +
" \"file_hash\": \"eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo=\"\n" +
" }\n" +
" }\n" +
"}";
private void appendLog(String log) {
Log.w("XX", log);
@ -85,7 +92,7 @@ public class TonTestJava {
return;
}
appendLog("config set ok");
TonApi.Key key = (TonApi.Key) client.send(new TonApi.CreateNewKey("local password".getBytes(), "mnemonic password".getBytes()));
TonApi.Key key = (TonApi.Key) client.send(new TonApi.CreateNewKey("local password".getBytes(), "mnemonic password".getBytes(), "".getBytes()));
appendLog("got private key");
TonApi.AccountAddress walletAddress = (TonApi.AccountAddress) client.send(new TonApi.TestWalletGetAccountAddress(new TonApi.TestWalletInitialAccountState(key.publicKey)));
appendLog("got account address");