Skip to content

134 remove accounttype #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d2d44e2
#134 omit account type
andy-shi88 Aug 9, 2019
923ec88
#134 omit account type
andy-shi88 Aug 9, 2019
7c1e265
#134 update block id due to account type removal
andy-shi88 Aug 9, 2019
fdb0895
#134 fix sendmoney cmd tools
andy-shi88 Aug 9, 2019
7fdd668
fix conflict
astaphobia Aug 9, 2019
1c4a2ed
fixed undefined BlockSmithID
astaphobia Aug 9, 2019
85cbfbc
Merge branch '134-remove-accounttype' of github.com:zoobc/zoobc-core …
astaphobia Aug 9, 2019
e31548e
fixed GetTransactionsRequest
astaphobia Aug 9, 2019
87e5f97
#134 fix lint
andy-shi88 Aug 9, 2019
a804adf
#134 fix tests
andy-shi88 Aug 9, 2019
bcab96e
#134 remove address length in db
andy-shi88 Aug 9, 2019
de58051
#134 fix conflict
andy-shi88 Aug 9, 2019
4574f99
refacored some codes for the new strategy
astaphobia Aug 9, 2019
c422a8f
#134 fix util test
andy-shi88 Aug 9, 2019
b4584f5
fixed conflict
astaphobia Aug 9, 2019
232453c
#134 blocksmith address length remove
andy-shi88 Aug 9, 2019
fa031a6
Merge branch '134-remove-accounttype' of github.com:zoobc/zoobc-core …
astaphobia Aug 9, 2019
d24918c
zoobc/zoobc-core#134 blocksmith address length revert
andy-shi88 Aug 9, 2019
6310d16
Merge branches '134-remove-accounttype' and '134-remove-accounttype' …
astaphobia Aug 9, 2019
284ce6c
fixed test cases
astaphobia Aug 9, 2019
b6c2e7c
#134 update query tests
andy-shi88 Aug 9, 2019
ee205b2
Merge branch '134-remove-accounttype' of github.com:zoobc/zoobc-core …
andy-shi88 Aug 9, 2019
4086c60
#134 remove account type
andy-shi88 Aug 12, 2019
77e66e2
#134 remove account type and add account address length
andy-shi88 Aug 12, 2019
8b628bd
#134 adjust query for account type deletion
andy-shi88 Aug 12, 2019
c5425f8
#134 adjust transaction type implementation for account type deletion
andy-shi88 Aug 12, 2019
de7683a
#134 blocksmith ID to blocksmith address in native/service package
andy-shi88 Aug 12, 2019
f42c769
#134 update schema commit
andy-shi88 Aug 12, 2019
585532e
#134 remove account ID constant size
andy-shi88 Aug 12, 2019
ff2c94b
#134 fix mempool table
andy-shi88 Aug 12, 2019
ade3c1f
#134 fix mempool tests
andy-shi88 Aug 12, 2019
99a32fe
#134 remove debug code
andy-shi88 Aug 12, 2019
6409e43
#134 remove account id usage
andy-shi88 Aug 12, 2019
6e50eac
#134 length of string error, should be length of []byte(string)
andy-shi88 Aug 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/client/GetAccountBalance/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func main() {
c := rpc_service.NewAccountBalanceServiceClient(conn)

response, err := c.GetAccountBalance(context.Background(), &rpc_model.GetAccountBalanceRequest{
AccountType: 0,
AccountAddress: "BCZnSfqpP5tqFQlMTYkDeBVFWnbyVK7vLr5ORFpTjgtN",
})

Expand Down
37 changes: 19 additions & 18 deletions api/client/PostTransaction/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,27 @@ func main() {
// 66, 6, 146, 16, 61, 104, 106, 112, 122, 96, 233, 224, 208, 119, 245, 148, 60, 9, 131, 211, 110, 68, 167, 115, 243, 251, 90, 64, 234,
// 66, 108, 30, 116, 9,
// },
// TransactionBytes: []byte{
// 1, 0, 1, 53, 119, 58, 93, 0, 0, 0, 0, 0, 0, 66, 67, 90, 110, 83, 102, 113, 112, 80, 53, 116, 113, 70, 81, 108, 77, 84, 89, 107, 68,
// 101, 66, 86, 70, 87, 110, 98, 121, 86, 75, 55, 118, 76, 114, 53, 79, 82, 70, 112, 84, 106, 103, 116, 78, 0, 0, 66, 67, 90, 75, 76,
// 118, 103, 85, 89, 90, 49, 75, 75, 120, 45, 106, 116, 70, 57, 75, 111, 74, 115, 107, 106, 86, 80, 118, 66, 57, 106, 112, 73, 106,
// 102, 122, 122, 73, 54, 122, 68, 87, 48, 74, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 16, 39, 0, 0, 0, 0, 0, 0, 32, 85, 34, 198, 89, 78,
// 166, 142, 59, 148, 243, 133, 69, 66, 123, 219, 2, 3, 229, 172, 221, 35, 185, 208, 43, 44, 172, 96, 166, 116, 205, 93, 78, 194, 153,
// 95, 243, 145, 108, 96, 42, 6, 186, 128, 59, 117, 83, 196, 26, 9, 15, 157, 215, 108, 180, 35, 195, 100, 7, 142, 47, 96, 108, 10,
// },
// add node
TransactionBytes: []byte{
2, 0, 1, 218, 138, 66, 93, 0, 0, 0, 0, 0, 0, 66, 67, 90, 110, 83, 102, 113, 112, 80, 53, 116, 113, 70, 81, 108, 77, 84, 89, 107,
68, 101, 66, 86, 70, 87, 110, 98, 121, 86, 75, 55, 118, 76, 114, 53, 79, 82, 70, 112, 84, 106, 103, 116, 78, 0, 0, 66, 67, 90, 75,
76, 118, 103, 85, 89, 90, 49, 75, 75, 120, 45, 106, 116, 70, 57, 75, 111, 74, 115, 107, 106, 86, 80, 118, 66, 57, 106, 112, 73, 106,
102, 122, 122, 73, 54, 122, 68, 87, 48, 74, 1, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 14, 6, 218, 170, 54, 60, 50, 2, 66, 130, 119, 226,
235, 126, 203, 5, 12, 152, 194, 170, 146, 43, 63, 224, 101, 127, 241, 62, 152, 187, 255, 0, 0, 66, 67, 90, 110, 83, 102, 113, 112,
80, 53, 116, 113, 70, 81, 108, 77, 84, 89, 107, 68, 101, 66, 86, 70, 87, 110, 98, 121, 86, 75, 55, 118, 76, 114, 53, 79, 82, 70, 112,
84, 106, 103, 116, 78, 9, 49, 50, 55, 46, 48, 46, 48, 46, 49, 160, 134, 1, 0, 0, 0, 0, 0, 118, 96, 0, 82, 83, 206, 138, 84, 224, 106,
207, 135, 30, 2, 186, 237, 239, 131, 229, 86, 45, 235, 250, 248, 8, 166, 83, 102, 108, 132, 208, 227, 121, 235, 59, 31, 146, 98, 125,
173, 86, 83, 138, 34, 164, 165, 200, 3, 149, 209, 190, 117, 102, 152, 173, 38, 151, 0, 212, 64, 253, 97, 123, 12,
1, 0, 0, 0, 1, 189, 0, 77, 93, 0, 0, 0, 0, 44, 0, 0, 0, 66, 67, 90, 110, 83, 102, 113, 112, 80, 53, 116, 113, 70, 81, 108,
77, 84, 89, 107, 68, 101, 66, 86, 70, 87, 110, 98, 121, 86, 75, 55, 118, 76, 114, 53, 79, 82, 70, 112, 84, 106, 103, 116,
78, 44, 0, 0, 0, 66, 67, 90, 75, 76, 118, 103, 85, 89, 90, 49, 75, 75, 120, 45, 106, 116, 70, 57, 75, 111, 74, 115, 107, 106,
86, 80, 118, 66, 57, 106, 112, 73, 106, 102, 122, 122, 73, 54, 122, 68, 87, 48, 74, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 16, 39,
0, 0, 0, 0, 0, 0, 180, 143, 228, 156, 234, 214, 183, 43, 200, 112, 178, 166, 134, 156, 224, 252, 184, 87, 52, 253, 43, 41, 14, 33,
164, 186, 47, 208, 46, 245, 86, 159, 153, 230, 238, 139, 175, 149, 30, 83, 185, 193, 20, 75, 208, 93, 146, 154, 84, 241, 156, 125,
95, 254, 211, 62, 46, 67, 42, 88, 91, 241, 79, 0,
},
// add node
// TransactionBytes: []byte{
// 2, 0, 1, 218, 138, 66, 93, 0, 0, 0, 0, 0, 0, 66, 67, 90, 110, 83, 102, 113, 112, 80, 53, 116, 113, 70, 81, 108, 77, 84, 89, 107,
// 68, 101, 66, 86, 70, 87, 110, 98, 121, 86, 75, 55, 118, 76, 114, 53, 79, 82, 70, 112, 84, 106, 103, 116, 78, 0, 0, 66, 67, 90, 75,
// 76, 118, 103, 85, 89, 90, 49, 75, 75, 120, 45, 106, 116, 70, 57, 75, 111, 74, 115, 107, 106, 86, 80, 118, 66, 57, 106, 112, 73, 106,
// 102, 122, 122, 73, 54, 122, 68, 87, 48, 74, 1, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 14, 6, 218, 170, 54, 60, 50, 2, 66, 130, 119, 226,
// 235, 126, 203, 5, 12, 152, 194, 170, 146, 43, 63, 224, 101, 127, 241, 62, 152, 187, 255, 0, 0, 66, 67, 90, 110, 83, 102, 113, 112,
// 80, 53, 116, 113, 70, 81, 108, 77, 84, 89, 107, 68, 101, 66, 86, 70, 87, 110, 98, 121, 86, 75, 55, 118, 76, 114, 53, 79, 82, 70, 112,
// 84, 106, 103, 116, 78, 9, 49, 50, 55, 46, 48, 46, 48, 46, 49, 160, 134, 1, 0, 0, 0, 0, 0, 118, 96, 0, 82, 83, 206, 138, 84, 224, 106,
// 207, 135, 30, 2, 186, 237, 239, 131, 229, 86, 45, 235, 250, 248, 8, 166, 83, 102, 108, 132, 208, 227, 121, 235, 59, 31, 146, 98, 125,
// 173, 86, 83, 138, 34, 164, 165, 200, 3, 149, 209, 190, 117, 102, 152, 173, 38, 151, 0, 212, 64, 253, 97, 123, 12,
// },
})

if err != nil {
Expand Down
4 changes: 1 addition & 3 deletions api/service/accountBalanceApiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"github.com/zoobc/zoobc-core/common/model"
"github.com/zoobc/zoobc-core/common/query"
"github.com/zoobc/zoobc-core/common/util"
)

type (
Expand All @@ -31,8 +30,7 @@ func (abs *AccountBalanceService) GetAccountBalance(request *model.GetAccountBal
err error
accountBalances []*model.AccountBalance
)
accountID := util.CreateAccountIDFromAddress(request.AccountType, request.AccountAddress)
accountBalanceQuery, arg := abs.AccountBalanceQuery.GetAccountBalanceByAccountID(accountID)
accountBalanceQuery, arg := abs.AccountBalanceQuery.GetAccountBalanceByAccountAddress(request.AccountAddress)
rows, err := abs.Executor.ExecuteSelect(accountBalanceQuery, arg)

if err != nil {
Expand Down
12 changes: 5 additions & 7 deletions api/service/accountBalanceApiService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package service
import (
"database/sql"
"errors"
"github.com/DATA-DOG/go-sqlmock"
"github.com/zoobc/zoobc-core/common/model"
"github.com/zoobc/zoobc-core/common/query"
"reflect"
"regexp"
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/zoobc/zoobc-core/common/model"
"github.com/zoobc/zoobc-core/common/query"
)

type (
Expand Down Expand Up @@ -71,7 +72,6 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) {
Executor: &mockExecutorGetAccountBalanceFail{},
},
args: args{request: &model.GetAccountBalanceRequest{
AccountType: 0,
AccountAddress: "BCZ000000000000",
}},
want: nil,
Expand All @@ -84,7 +84,6 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) {
Executor: &mockExecutorGetAccountBalanceNotFound{},
},
args: args{request: &model.GetAccountBalanceRequest{
AccountType: 0,
AccountAddress: "BCZ000000000000",
}},
want: nil,
Expand All @@ -97,12 +96,11 @@ func TestAccountBalanceService_GetAccountBalance(t *testing.T) {
Executor: &mockExecutorGetAccountBalanceSuccess{},
},
args: args{request: &model.GetAccountBalanceRequest{
AccountType: 0,
AccountAddress: "BCZ000000000000",
}},
want: &model.GetAccountBalanceResponse{
AccountBalance: &model.AccountBalance{
AccountID: []byte{1},
AccountAddress: "\001",
BlockHeight: 1,
SpendableBalance: 10000,
Balance: 10000,
Expand Down
1 change: 1 addition & 0 deletions api/service/blockApiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (bs *BlockService) GetBlockByID(chainType contract.ChainType, id int64) (*m
return nil, err
}
defer rows.Close()

bl = blockQuery.BuildModel(bl, rows)
if len(bl) == 0 {
return nil, errors.New("BlockNotFound")
Expand Down
Loading