Commit 3536624c authored by mdj33's avatar mdj33 Committed by 33cn

add debug log

parent eea1a428
...@@ -134,10 +134,11 @@ out: ...@@ -134,10 +134,11 @@ out:
client.checkTxCommitTimes = 0 client.checkTxCommitTimes = 0
sendMsgCh <- client.currentTx sendMsgCh <- client.currentTx
txhash := common.ToHex(signTx.Hash())
for i, msg := range sendingMsgs { for i, msg := range sendingMsgs {
plog.Info("paracommitmsg sending", "idx", i, "height", msg.Height, "mainheight", msg.MainBlockHeight, plog.Info("paracommitmsg sending", "idx", i, "height", msg.Height, "mainheight", msg.MainBlockHeight,
"blockhash", common.HashHex(msg.BlockHash), "mainHash", common.HashHex(msg.MainBlockHash), "blockhash", common.HashHex(msg.BlockHash), "mainHash", common.HashHex(msg.MainBlockHash),
"from", client.paraClient.authAccount) "txhash", txhash, "from", client.paraClient.authAccount)
} }
} }
...@@ -293,20 +294,20 @@ func (client *commitMsgClient) singleCalcTx(status *pt.ParacrossNodeStatus) (*ty ...@@ -293,20 +294,20 @@ func (client *commitMsgClient) singleCalcTx(status *pt.ParacrossNodeStatus) (*ty
func (client *commitMsgClient) sendCommitMsg(ch chan *types.Transaction) { func (client *commitMsgClient) sendCommitMsg(ch chan *types.Transaction) {
var err error var err error
var tx *types.Transaction var tx *types.Transaction
resendTimer := time.After(time.Second * 1) var resendTimer <-chan time.Time
out: out:
for { for {
select { select {
case tx = <-ch: case tx = <-ch:
err = client.sendCommitMsgTx(tx) err = client.sendCommitMsgTx(tx)
if err != nil { if err != nil && err != types.ErrBalanceLessThanTenTimesFee {
resendTimer = time.After(time.Second * 1) resendTimer = time.After(time.Second * 1)
} }
case <-resendTimer: case <-resendTimer:
if err != nil && tx != nil { if err != nil && tx != nil {
err = client.sendCommitMsgTx(tx) err = client.sendCommitMsgTx(tx)
if err != nil { if err != nil && err != types.ErrBalanceLessThanTenTimesFee {
resendTimer = time.After(time.Second * 1) resendTimer = time.After(time.Second * 1)
} }
} }
...@@ -324,12 +325,12 @@ func (client *commitMsgClient) sendCommitMsgTx(tx *types.Transaction) error { ...@@ -324,12 +325,12 @@ func (client *commitMsgClient) sendCommitMsgTx(tx *types.Transaction) error {
} }
resp, err := client.paraClient.grpcClient.SendTransaction(context.Background(), tx) resp, err := client.paraClient.grpcClient.SendTransaction(context.Background(), tx)
if err != nil { if err != nil {
plog.Error("sendCommitMsgTx send tx", "tx", tx.Hash(), "err", err.Error()) plog.Error("sendCommitMsgTx send tx", "tx", common.ToHex(tx.Hash()), "err", err.Error())
return err return err
} }
if !resp.GetIsOk() { if !resp.GetIsOk() {
plog.Error("sendCommitMsgTx send tx Nok", "tx", tx.Hash(), "err", string(resp.GetMsg())) plog.Error("sendCommitMsgTx send tx Nok", "tx", common.ToHex(tx.Hash()), "err", string(resp.GetMsg()))
return errors.New(string(resp.GetMsg())) return errors.New(string(resp.GetMsg()))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment