X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=protocol%2Fbc%2Ftypes%2Fmap.go;h=0fe229dc7ff4be0d5c56a673e3c84790a68f7e23;hp=170b9f092cb6f9975565fe3855e3323a2139d710;hb=91641ae15f80f23c21745bbdf9357e7124803eee;hpb=9d6411618dc26b22d6b1943dc0e600e1e6dd072f diff --git a/protocol/bc/types/map.go b/protocol/bc/types/map.go index 170b9f09..0fe229dc 100644 --- a/protocol/bc/types/map.go +++ b/protocol/bc/types/map.go @@ -2,6 +2,7 @@ package types import ( log "github.com/sirupsen/logrus" + "golang.org/x/crypto/sha3" "github.com/vapor/consensus" "github.com/vapor/protocol/bc" @@ -140,16 +141,26 @@ func mapTx(tx *TxData) (headerID bc.Hash, hdr *bc.TxHeader, entryMap map[bc.Hash vetoInputs = append(vetoInputs, vetoInput) case *CrossChainInput: - // TODO: fed peg script prog := &bc.Program{VmVersion: inp.VMVersion, Code: inp.ControlProgram} src := &bc.ValueSource{ Ref: &inp.SourceID, Value: &inp.AssetAmount, Position: inp.SourcePosition, } + prevout := bc.NewIntraChainOutput(src, prog, 0) // ordinal doesn't matter outputID := bc.EntryID(prevout) - crossIn := bc.NewCrossChainInput(&outputID, &inp.AssetAmount, prog, uint64(i)) + + assetDefHash := bc.NewHash(sha3.Sum256(inp.AssetDefinition)) + assetDef := &bc.AssetDefinition{ + Data: &assetDefHash, + IssuanceProgram: &bc.Program{ + VmVersion: inp.VMVersion, + Code: inp.IssuanceProgram, + }, + } + + crossIn := bc.NewCrossChainInput(&outputID, &inp.AssetAmount, prog, uint64(i), assetDef) crossIn.WitnessArguments = inp.Arguments crossInID := addEntry(crossIn) muxSources[i] = &bc.ValueSource{