OSDN Git Service

fix: add
authorHAOYUatHZ <haoyu@protonmail.com>
Tue, 21 May 2019 08:56:02 +0000 (16:56 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Tue, 21 May 2019 08:56:02 +0000 (16:56 +0800)
account/builder.go
blockchain/txfeed/txfeed.go
protocol/bc/types/transaction.go
wallet/annotated.go

index 2470481..e8b76f7 100644 (file)
@@ -94,6 +94,7 @@ func (a *crossInAction) Build(ctx context.Context, b *txbuilder.TemplateBuilder)
        }
 
        // TODO: IssuanceProgram vs arguments?
+       // TODO: also need to hard-code mapTx
        // TODO: save AssetDefinition
 
        // txin := types.NewIssuanceInput(nonce[:], a.Amount, asset.IssuanceProgram, nil, asset.RawDefinitionByte)
index 5a0396f..926a819 100644 (file)
@@ -353,6 +353,10 @@ func buildAnnotatedInput(tx *types.Tx, i uint32) *query.AnnotatedInput {
                in.Type = "spend"
                in.ControlProgram = orig.ControlProgram()
                in.SpentOutputID = e.SpentOutputId
+       case *bc.CrossChainInput:
+               in.Type = "cross_chain_in"
+               in.ControlProgram = orig.ControlProgram()
+               in.SpentOutputID = e.MainnetOutputId
        }
 
        return in
index 383ea30..08e6f6c 100644 (file)
@@ -51,6 +51,8 @@ func (tx *Tx) SetInputArguments(n uint32, args [][]byte) {
        switch e := e.(type) {
        case *bc.Spend:
                e.WitnessArguments = args
+       case *bc.CrossChainInput:
+               e.WitnessArguments = args
        }
 }
 
index 4d25ce8..2e7dfeb 100644 (file)
@@ -181,6 +181,15 @@ func (w *Wallet) BuildAnnotatedInput(tx *types.Tx, i uint32) *query.AnnotatedInp
        in.InputID = id
        e := tx.Entries[id]
        switch e := e.(type) {
+       case *bc.CrossChainInput:
+               in.Type = "cross_chain_in"
+               in.ControlProgram = orig.ControlProgram()
+               in.Address = w.getAddressFromControlProgram(in.ControlProgram)
+               in.SpentOutputID = e.MainnetOutputId
+               arguments := orig.Arguments()
+               for _, arg := range arguments {
+                       in.WitnessArguments = append(in.WitnessArguments, arg)
+               }
        case *bc.Spend:
                in.Type = "spend"
                in.ControlProgram = orig.ControlProgram()