OSDN Git Service
(root)
/
bytom
/
vapor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
filter out known txs (#280)
[bytom/vapor.git]
/
account
/
builder.go
diff --git
a/account/builder.go
b/account/builder.go
index
af0c0a1
..
143ad24
100644
(file)
--- a/
account/builder.go
+++ b/
account/builder.go
@@
-90,7
+90,7
@@
func (m *Manager) reserveBtmUtxoChain(builder *txbuilder.TemplateBuilder, accoun
return utxos, nil
}
return utxos, nil
}
-func (m *Manager)
b
uildBtmTxChain(utxos []*UTXO, signer *signers.Signer) ([]*txbuilder.Template, *UTXO, error) {
+func (m *Manager)
B
uildBtmTxChain(utxos []*UTXO, signer *signers.Signer) ([]*txbuilder.Template, *UTXO, error) {
if len(utxos) == 0 {
return nil, nil, errors.New("mergeSpendActionUTXO utxos num 0")
}
if len(utxos) == 0 {
return nil, nil, errors.New("mergeSpendActionUTXO utxos num 0")
}
@@
-166,6
+166,7
@@
func SpendAccountChain(ctx context.Context, builder *txbuilder.TemplateBuilder,
if !ok {
return nil, errors.New("fail to convert the spend action")
}
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")
}
if *act.AssetId != *consensus.BTMAssetID {
return nil, errors.New("spend chain action only support BTM")
}
@@
-180,7
+181,7
@@
func SpendAccountChain(ctx context.Context, builder *txbuilder.TemplateBuilder,
return nil, err
}
return nil, err
}
- tpls, utxo, err := act.accounts.
b
uildBtmTxChain(utxos, acct.Signer)
+ tpls, utxo, err := act.accounts.
B
uildBtmTxChain(utxos, acct.Signer)
if err != nil {
return nil, err
}
if err != nil {
return nil, err
}
@@
-313,7
+314,7
@@
func UtxoToInputs(signer *signers.Signer, u *UTXO) (*types.TxInput, *txbuilder.S
if u.Vote == nil {
txInput = types.NewSpendInput(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram)
} else {
if u.Vote == nil {
txInput = types.NewSpendInput(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram)
} else {
- txInput = types.New
Unvote
Input(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram, u.Vote)
+ txInput = types.New
Veto
Input(nil, u.SourceID, u.AssetID, u.Amount, u.SourcePos, u.ControlProgram, u.Vote)
}
sigInst := &txbuilder.SigningInstruction{}
if signer == nil {
}
sigInst := &txbuilder.SigningInstruction{}
if signer == nil {
@@
-324,6
+325,7
@@
func UtxoToInputs(signer *signers.Signer, u *UTXO) (*types.TxInput, *txbuilder.S
if err != nil {
return nil, nil, err
}
if err != nil {
return nil, nil, err
}
+
if u.Address == "" {
sigInst.AddWitnessKeys(signer.XPubs, path, signer.Quorum)
return txInput, sigInst, nil
if u.Address == "" {
sigInst.AddWitnessKeys(signer.XPubs, path, signer.Quorum)
return txInput, sigInst, nil
@@
-382,17
+384,18
@@
func (m *Manager) insertControlProgramDelayed(b *txbuilder.TemplateBuilder, acp
if len(acps) == 0 {
return nil
}
if len(acps) == 0 {
return nil
}
+
return m.SaveControlPrograms(acps...)
})
}
return m.SaveControlPrograms(acps...)
})
}
-//Decode
Unvote
Action unmarshal JSON-encoded data of spend action
-func (m *Manager) Decode
Unvote
Action(data []byte) (txbuilder.Action, error) {
- a := &
unvote
Action{accounts: m}
+//Decode
Veto
Action unmarshal JSON-encoded data of spend action
+func (m *Manager) Decode
Veto
Action(data []byte) (txbuilder.Action, error) {
+ a := &
veto
Action{accounts: m}
return a, stdjson.Unmarshal(data, a)
}
return a, stdjson.Unmarshal(data, a)
}
-type
unvote
Action struct {
+type
veto
Action struct {
accounts *Manager
bc.AssetAmount
AccountID string `json:"account_id"`
accounts *Manager
bc.AssetAmount
AccountID string `json:"account_id"`
@@
-400,11
+403,11
@@
type unvoteAction struct {
UseUnconfirmed bool `json:"use_unconfirmed"`
}
UseUnconfirmed bool `json:"use_unconfirmed"`
}
-func (a *
unvote
Action) ActionType() string {
- return "
unvote
"
+func (a *
veto
Action) ActionType() string {
+ return "
veto
"
}
}
-func (a *
unvote
Action) Build(ctx context.Context, b *txbuilder.TemplateBuilder) error {
+func (a *
veto
Action) Build(ctx context.Context, b *txbuilder.TemplateBuilder) error {
var missing []string
if a.AccountID == "" {
missing = append(missing, "account_id")
var missing []string
if a.AccountID == "" {
missing = append(missing, "account_id")