X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=blockchain%2Ftxbuilder%2Factions.go;h=f5b40bc0b1b9cfbb0ae690e6db7d623007c5f828;hb=312e5053f0a820931cb5b0c68d418f8614f426b9;hp=f06c3ed6683b36dfd9648770afb31d4350942aed;hpb=91641ae15f80f23c21745bbdf9357e7124803eee;p=bytom%2Fvapor.git diff --git a/blockchain/txbuilder/actions.go b/blockchain/txbuilder/actions.go index f06c3ed6..f5b40bc0 100644 --- a/blockchain/txbuilder/actions.go +++ b/blockchain/txbuilder/actions.go @@ -8,7 +8,7 @@ import ( "golang.org/x/crypto/sha3" "github.com/vapor/common" - "github.com/vapor/config" + cfg "github.com/vapor/config" "github.com/vapor/consensus" "github.com/vapor/encoding/json" "github.com/vapor/protocol/bc" @@ -168,7 +168,7 @@ func (a *crossOutAction) Build(ctx context.Context, b *TemplateBuilder) error { return MissingFieldsError(missing...) } - address, err := common.DecodeAddress(a.Address, &consensus.MainNetParams) + address, err := common.DecodeAddress(a.Address, consensus.BytomMainNetParams(&consensus.ActiveNetParams)) if err != nil { return err } @@ -262,11 +262,11 @@ func DecodeCrossInAction(data []byte) (Action, error) { type crossInAction struct { bc.AssetAmount - SourceID bc.Hash `json:"source_id"` - SourcePos uint64 `json:"source_pos"` - VMVersion uint64 `json:"vm_version"` - RawDefinitionByte []byte `json:"raw_definition_byte"` - IssuanceProgram []byte `json:"issuance_program"` + SourceID bc.Hash `json:"source_id"` + SourcePos uint64 `json:"source_pos"` + VMVersion uint64 `json:"vm_version"` + RawDefinitionByte json.HexBytes `json:"raw_definition_byte"` + IssuanceProgram json.HexBytes `json:"issuance_program"` } func (a *crossInAction) Build(ctx context.Context, builder *TemplateBuilder) error { @@ -292,8 +292,9 @@ func (a *crossInAction) Build(ctx context.Context, builder *TemplateBuilder) err // arguments will be set when materializeWitnesses txin := types.NewCrossChainInput(nil, a.SourceID, *a.AssetId, a.Amount, a.SourcePos, a.VMVersion, a.RawDefinitionByte, a.IssuanceProgram) tplIn := &SigningInstruction{} - fed := config.CommonConfig.Federation - tplIn.AddRawWitnessKeys(fed.Xpubs, nil, fed.Quorum) + fed := cfg.CommonConfig.Federation + tplIn.AddRawWitnessKeys(fed.Xpubs, cfg.FedAddressPath, fed.Quorum) + tplIn.AddDataWitness(cfg.FederationPMultiSigScript(cfg.CommonConfig)) return builder.AddInput(txin, tplIn) } @@ -305,7 +306,7 @@ func (c *crossInAction) checkAssetID() error { defHash := bc.NewHash(sha3.Sum256(c.RawDefinitionByte)) assetID := bc.ComputeAssetID(c.IssuanceProgram, c.VMVersion, &defHash) - if *c.AssetId == *consensus.BTMAssetID && assetID != *c.AssetAmount.AssetId { + if *c.AssetId != *consensus.BTMAssetID && assetID != *c.AssetAmount.AssetId { return errors.New("incorrect asset_idincorrect asset_id") }