OSDN Git Service

Add the implementation for dppos
[bytom/vapor.git] / blockchain / txbuilder / builder.go
index b93b6db..a9f5e06 100644 (file)
@@ -24,6 +24,7 @@ type TemplateBuilder struct {
        timeRange           uint64
        rollbacks           []func()
        callbacks           []func() error
+       referenceData       []byte
 }
 
 // AddInput add inputs of transactions
@@ -45,6 +46,10 @@ func (b *TemplateBuilder) AddOutput(o *types.TxOutput) error {
        return nil
 }
 
+func (b *TemplateBuilder) SetReferenceData(referenceData []byte) {
+       b.referenceData = referenceData
+}
+
 // InputCount return number of input in the template builder
 func (b *TemplateBuilder) InputCount() int {
        return len(b.inputs)
@@ -131,6 +136,8 @@ func (b *TemplateBuilder) Build() (*Template, *types.TxData, error) {
                tx.Inputs = append(tx.Inputs, in)
        }
 
+       tx.ReferenceData = b.referenceData
+
        tpl.Transaction = types.NewTx(*tx)
        tpl.Fee = CalculateTxFee(tpl.Transaction)
        return tpl, tx, nil