Skip to content

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gordon-sero committed Sep 18, 2019
1 parent cc7dd35 commit 2637269
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/ethapi/api_flight.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func (s *PublicFlightAPI) CommitTx(ctx context.Context, args *txtool.GTx) error
return s.exchange.CommitTx(ctx, args)
}

func (s *PublicFlightAPI) Trace2Root(ctx context.Context, tk TKAddress, trace keys.Uint256) (root keys.Uint256, e error) {
if r := flight.Trace2Root(tk.ToUint512().NewRef(), &trace); r != nil {
func (s *PublicFlightAPI) Trace2Root(ctx context.Context, tk TKAddress, trace keys.Uint256, base keys.Uint256) (root keys.Uint256, e error) {
if r := flight.Trace2Root(tk.ToUint512().NewRef(), &trace, &base); r != nil {
root = *r
return
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/web3ext/web3ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ web3._extend({
new web3._extend.Method({
name: 'Trace2Root',
call: 'flight_trace2Root',
params: 2
params: 3
}),
new web3._extend.Method({
name: 'getOut',
Expand Down
3 changes: 2 additions & 1 deletion zero/txtool/flight/sli.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ func DecTraceOuts(outs []txtool.Out, skr *keys.PKr) (douts []txtool.TDOut) {

func (self *SLI) GenTx(param *txtool.GTxParam) (gtx txtool.GTx, e error) {

if tx, keys, err := generate.GenTx(param); err != nil {
if tx, keys, bases, err := generate.GenTx(param); err != nil {
e = err
return
} else {
gtx.Tx = tx
gtx.Keys = keys
gtx.Bases = bases
gtx.Gas = hexutil.Uint64(param.Gas)
gtx.GasPrice = hexutil.Big(*param.GasPrice)
gtx.Hash = tx.ToHash()
Expand Down
2 changes: 1 addition & 1 deletion zero/txtool/flight/sri.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type SRI struct {

var SRI_Inst = SRI{}

func Trace2Root(tk *keys.Uint512, trace *keys.Uint256) (root *keys.Uint256) {
func Trace2Root(tk *keys.Uint512, trace *keys.Uint256, base *keys.Uint256) (root *keys.Uint256) {
root_cm := cpt.FetchRootCM(tk, trace)
root = localdb.GetRootByRootCM(txtool.Ref_inst.Bc.GetDB(), &root_cm)
return
Expand Down
4 changes: 3 additions & 1 deletion zero/txtool/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ type gen_ctx struct {
Z_Ins []txtool.GIn
balance_desc cpt.BalanceDesc
Keys []keys.Uint256
Bases []keys.Uint256
s stx.T
}

func GenTx(param *txtool.GTxParam) (ret stx.T, keys []keys.Uint256, e error) {
func GenTx(param *txtool.GTxParam) (ret stx.T, keys []keys.Uint256, bases []keys.Uint256, e error) {
ctx := gen_ctx{}
ctx.param = *param
ctx.prepare()
Expand All @@ -42,6 +43,7 @@ func GenTx(param *txtool.GTxParam) (ret stx.T, keys []keys.Uint256, e error) {
}
ret = ctx.s
keys = ctx.Keys
bases = ctx.Bases
return
}

Expand Down
2 changes: 1 addition & 1 deletion zero/txtool/generate/prove_proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (self *gen_ctx) genDesc_Zs() (e error) {
in_z.Trace = desc.Til_ret
in_z.Proof = desc.Proof_ret
self.s.Desc_Z.Ins[input_desc.index] = in_z

self.Bases = append(self.Bases, keys.Empty_Uint256)
self.balance_desc.Zin_acms = append(self.balance_desc.Zin_acms, desc.Asset_cm_ret[:]...)
self.balance_desc.Zin_ars = append(self.balance_desc.Zin_ars, desc.Ar_ret[:]...)
}
Expand Down
1 change: 1 addition & 0 deletions zero/txtool/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type GTx struct {
Hash keys.Uint256
Roots []keys.Uint256
Keys []keys.Uint256
Bases []keys.Uint256
}

type GPkgCloseCmd struct {
Expand Down

0 comments on commit 2637269

Please sign in to comment.