-
Notifications
You must be signed in to change notification settings - Fork 3
40 post transaction #96
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
40 post transaction #96
Conversation
api/api.go
Outdated
@@ -4,6 +4,12 @@ import ( | |||
"fmt" | |||
"net" | |||
|
|||
"github.com/zoobc/zoobc-core/common/chaintype" | |||
service2 "github.com/zoobc/zoobc-core/core/service" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the service2 ?
cmd/main.go
Outdated
@@ -3,12 +3,15 @@ package main | |||
import ( | |||
"github.com/spf13/cobra" | |||
"github.com/zoobc/zoobc-core/cmd/account" | |||
"github.com/zoobc/zoobc-core/cmd/transaction" | |||
"github.com/zoobc/zoobc-core/common/crypto" | |||
"github.com/zoobc/zoobc-core/common/util" | |||
) | |||
|
|||
func main() { | |||
var rootCmd = &cobra.Command{Use: "zoobc"} | |||
logger, _ := util.InitLogger(".log/", "debug.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to save log file with the specific name, like cmd.log
or cmd.debug.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -28,6 +28,7 @@ func (m *Migration) Init() error { | |||
if m.Query != nil { | |||
rows, _ := m.Query.ExecuteSelect("SELECT version FROM migration;") | |||
if rows != nil { | |||
defer rows.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure defer will be trigger even if rows
is nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested, it won't it will only defer when row != nil
proofed by no panick, since if it's nil, calling row.Close()
would result in panic.
var ( | ||
recipientAccount model.Account | ||
senderAccount model.Account | ||
err error | ||
) | ||
|
||
if tx.Height > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if tx.Validate()
got error
need to UndoApplyUnconfirmed()
or not ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check on this one, since mempool is executing validate
function on get transaction, I'm not sure if I should keep validation inside ApplyConfirmed
or the other way, let me think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, if validate fail, should not do undo. Updated in newest commit.
updated, please check 👍 @capt4ce @astaphobia |
wip, need to check the validate function |
api/client/PostTransaction/client.go
Outdated
c := rpc_service.NewTransactionServiceClient(conn) | ||
|
||
response, err := c.PostTransaction(context.Background(), &rpc_model.PostTransactionRequest{ | ||
// TransactionBytes: []byte{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it still of any useful? otherwise I think we should remove it, what do you think?
Description
Open
post-transaction
rpc endpoint.Breakdown
post-transaction
endpointVET
handling for account-balanceReference Issue
Close #40
Step to Test (optional)
go run main.go
go run api/client/PostTransaction/client.go