OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / protocol / bc / veto_input.go
diff --git a/protocol/bc/veto_input.go b/protocol/bc/veto_input.go
new file mode 100644 (file)
index 0000000..71975c5
--- /dev/null
@@ -0,0 +1,25 @@
+package bc
+
+import "io"
+
+func (VetoInput) typ() string { return "vetoInput1" }
+func (s *VetoInput) writeForHash(w io.Writer) {
+       mustWriteForHash(w, s.SpentOutputId)
+}
+
+// SetDestination will link the spend to the output
+func (s *VetoInput) SetDestination(id *Hash, val *AssetAmount, pos uint64) {
+       s.WitnessDestination = &ValueDestination{
+               Ref:      id,
+               Value:    val,
+               Position: pos,
+       }
+}
+
+// NewVetoInput creates a new VetoInput.
+func NewVetoInput(spentOutputID *Hash, ordinal uint64) *VetoInput {
+       return &VetoInput{
+               SpentOutputId: spentOutputID,
+               Ordinal:       ordinal,
+       }
+}