From 696e26ccfd7b7d468f80dc70a305715946c1afa8 Mon Sep 17 00:00:00 2001 From: Andrej Zavgorodnij Date: Fri, 11 Sep 2020 02:06:09 +0300 Subject: [PATCH] updated default chunk size --- README.md | 8 ++++++++ client/client.go | 2 +- qr/chunk.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6152f43..817b719 100644 --- a/README.md +++ b/README.md @@ -142,14 +142,22 @@ Node 1: 1. go run cmd/dc4bc_d/main.go gen_keys --username node_1 --key_store_dbdsn /tmp/dc4bc_node_1_key_store 2. go run cmd/dc4bc_d/main.go start --username node_1 --key_store_dbdsn /tmp/dc4bc_node_1_key_store --listen_addr localhost:8080 --state_dbdsn /tmp/dc4bc_node_1_state --storage_dbdsn /tmp/dc4bc_storage +3. go run cmd/dc4bc_cli/main.go get_address --listen_addr localhost:8080 +4. go run cmd/airgapped/main.go /tmp/dc4bc_node_1_airgapped_state Node 2: 1. go run cmd/dc4bc_d/main.go gen_keys --username node_2 --key_store_dbdsn /tmp/dc4bc_node_2_key_store 2. go run cmd/dc4bc_d/main.go start --username node_2 --key_store_dbdsn /tmp/dc4bc_node_2_key_store --listen_addr localhost:8081 --state_dbdsn /tmp/dc4bc_node_2_state --storage_dbdsn /tmp/dc4bc_storage +3. go run cmd/dc4bc_cli/main.go get_address --listen_addr localhost:8080 +4. go run cmd/airgapped/main.go /tmp/dc4bc_node_2_airgapped_state #### Start the DKG 1. go run cmd/dc4bc_cli/main.go get_address --listen_addr localhost:8080 2. go run cmd/dc4bc_cli/main.go get_address --listen_addr localhost:8081 3. go run cmd/dc4bc_cli/main.go start_dkg 2 2 --listen_addr localhost:8080 + +#### Perform required operations for both nodes + +1. go run cmd/dc4bc_cli/main.go get_operations --listen_addr localhost:8080 diff --git a/client/client.go b/client/client.go index 7447030..d8f15a8 100644 --- a/client/client.go +++ b/client/client.go @@ -259,7 +259,7 @@ func (c *Client) GetOperationQRPath(operationID string) ([]string, error) { return nil, fmt.Errorf("failed to get operation in JSON: %w", err) } - operationQRPath := filepath.Join(QrCodesDir, operationID) + operationQRPath := filepath.Join(QrCodesDir, fmt.Sprintf("qr_dc4bc_%s", operationID)) chunks, err := qr.DataToChunks(operationJSON) if err != nil { return nil, fmt.Errorf("failed to divide a data on chunks: %w", err) diff --git a/qr/chunk.go b/qr/chunk.go index 7b8f964..f19321e 100644 --- a/qr/chunk.go +++ b/qr/chunk.go @@ -7,7 +7,7 @@ import ( "math" ) -const chunkSize = 1024 +const chunkSize = 512 type chunk struct { Data []byte