"context"
stdjson "encoding/json"
- "github.com/vapor/blockchain/signers"
- "github.com/vapor/blockchain/txbuilder"
- "github.com/vapor/common"
- "github.com/vapor/consensus"
- "github.com/vapor/crypto/ed25519/chainkd"
- "github.com/vapor/encoding/json"
- "github.com/vapor/errors"
- "github.com/vapor/protocol/bc"
- "github.com/vapor/protocol/bc/types"
- "github.com/vapor/protocol/vm/vmutil"
+ "github.com/bytom/vapor/blockchain/signers"
+ "github.com/bytom/vapor/blockchain/txbuilder"
+ "github.com/bytom/vapor/common"
+ "github.com/bytom/vapor/consensus"
+ "github.com/bytom/vapor/crypto/ed25519/chainkd"
+ "github.com/bytom/vapor/encoding/json"
+ "github.com/bytom/vapor/errors"
+ "github.com/bytom/vapor/protocol/bc"
+ "github.com/bytom/vapor/protocol/bc/types"
+ "github.com/bytom/vapor/protocol/vm/vmutil"
)
var (
//chainTxUtxoNum maximum utxo quantity in a tx
- chainTxUtxoNum = 5
+ chainTxUtxoNum = 20
//chainTxMergeGas chain tx gas
- chainTxMergeGas = uint64(10000000)
+ chainTxMergeGas = uint64(0)
)
//DecodeSpendAction unmarshal JSON-encoded data of spend action
return utxos, nil
}
-func (m *Manager) buildBtmTxChain(utxos []*UTXO, signer *signers.Signer) ([]*txbuilder.Template, *UTXO, error) {
+func (m *Manager) BuildBtmTxChain(utxos []*UTXO, signer *signers.Signer) ([]*txbuilder.Template, *UTXO, error) {
if len(utxos) == 0 {
return nil, nil, errors.New("mergeSpendActionUTXO utxos num 0")
}
if !ok {
return nil, errors.New("fail to convert the spend action")
}
+
if *act.AssetId != *consensus.BTMAssetID {
return nil, errors.New("spend chain action only support BTM")
}
return nil, err
}
- tpls, utxo, err := act.accounts.buildBtmTxChain(utxos, acct.Signer)
+ tpls, utxo, err := act.accounts.BuildBtmTxChain(utxos, acct.Signer)
if err != nil {
return nil, err
}
if err != nil {
return nil, nil, err
}
+
if u.Address == "" {
sigInst.AddWitnessKeys(signer.XPubs, path, signer.Quorum)
return txInput, sigInst, nil
if len(acps) == 0 {
return nil
}
+
return m.SaveControlPrograms(acps...)
})
}
-//DecodeUnvoteAction unmarshal JSON-encoded data of spend action
-func (m *Manager) DecodeUnvoteAction(data []byte) (txbuilder.Action, error) {
- a := &unvoteAction{accounts: m}
+//DecodeVetoAction unmarshal JSON-encoded data of spend action
+func (m *Manager) DecodeVetoAction(data []byte) (txbuilder.Action, error) {
+ a := &vetoAction{accounts: m}
return a, stdjson.Unmarshal(data, a)
}
-type unvoteAction struct {
+type vetoAction struct {
accounts *Manager
bc.AssetAmount
AccountID string `json:"account_id"`
UseUnconfirmed bool `json:"use_unconfirmed"`
}
-func (a *unvoteAction) ActionType() string {
- return "unvote"
+func (a *vetoAction) ActionType() string {
+ return "veto"
}
-func (a *unvoteAction) Build(ctx context.Context, b *txbuilder.TemplateBuilder) error {
+func (a *vetoAction) Build(ctx context.Context, b *txbuilder.TemplateBuilder) error {
var missing []string
if a.AccountID == "" {
missing = append(missing, "account_id")