X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=api%2Ftransact.go;h=2b11215e1f71381f7b28db1fd0ddec9ef55b4116;hp=1c0f27411b6f847e35f1acd34d1ab91a0d944ac1;hb=ee01d543fdfe1fd0a4d548965c66f7923ea7b062;hpb=8964bcf0ffc12618f95c54f6677fcf45c7919534 diff --git a/api/transact.go b/api/transact.go index 1c0f2741..2b11215e 100644 --- a/api/transact.go +++ b/api/transact.go @@ -34,6 +34,8 @@ func (a *API) actionDecoder(action string) (func([]byte) (txbuilder.Action, erro "retire": txbuilder.DecodeRetireAction, "spend_account": a.wallet.AccountMgr.DecodeSpendAction, "spend_account_unspent_output": a.wallet.AccountMgr.DecodeSpendUTXOAction, + "dpos": a.wallet.AccountMgr.DecodeDposAction, + "ipfs_data": txbuilder.DecodeIpfsDataAction, } decoder, ok := decoders[action] return decoder, ok @@ -41,17 +43,24 @@ func (a *API) actionDecoder(action string) (func([]byte) (txbuilder.Action, erro func onlyHaveInputActions(req *BuildRequest) (bool, error) { count := 0 + dpos := false for i, act := range req.Actions { actionType, ok := act["type"].(string) if !ok { return false, errors.WithDetailf(ErrBadActionType, "no action type provided on action %d", i) } - + if strings.HasPrefix(actionType, "dpos") { + dpos = true + } if strings.HasPrefix(actionType, "spend") || actionType == "issue" { count++ } } + if dpos == true && count == 0 { + return false, nil + } + return count == len(req.Actions), nil }