(tx pi.Transaction)
| 293 | } |
| 294 | |
| 295 | func fillTxNonce(tx pi.Transaction) (err error) { |
| 296 | _, err = nestedWalkFillTxNonce(reflect.ValueOf(tx), "", func(fieldPath string, rv reflect.Value) (err error) { |
| 297 | var ( |
| 298 | pubKey *asymmetric.PublicKey |
| 299 | accountAddr proto.AccountAddress |
| 300 | ) |
| 301 | if pubKey, err = kms.GetLocalPublicKey(); err != nil { |
| 302 | return |
| 303 | } |
| 304 | if accountAddr, err = crypto.PubKeyHash(pubKey); err != nil { |
| 305 | return |
| 306 | } |
| 307 | nonceReq := &types.NextAccountNonceReq{ |
| 308 | Addr: accountAddr, |
| 309 | } |
| 310 | nonceResp := &types.NextAccountNonceResp{} |
| 311 | if err = rpc.NewCaller().CallNode(proto.NodeID(rpcEndpoint), |
| 312 | route.MCCNextAccountNonce.String(), nonceReq, nonceResp); err != nil { |
| 313 | return |
| 314 | } |
| 315 | |
| 316 | rv.SetUint(uint64(nonceResp.Nonce)) |
| 317 | ConsoleLog.Infof("filled tx type %s nonce field %s with nonce %d", |
| 318 | tx.GetTransactionType().String(), fieldPath, nonceResp.Nonce) |
| 319 | |
| 320 | return |
| 321 | }) |
| 322 | |
| 323 | return |
| 324 | } |
| 325 | |
| 326 | func resolveRPCEntities() (req interface{}, resp interface{}) { |
| 327 | rpcParts := strings.SplitN(rpcName, ".", 2) |
no test coverage detected