github.com/Bytom/bytom@v1.1.2-0.20210127130405-ae40204c0b09/protocol/bc/mux.go (about)

     1  package bc
     2  
     3  import "io"
     4  
     5  // Mux splits and combines value from one or more source entries,
     6  // making it available to one or more destination entries. It
     7  // satisfies the Entry interface.
     8  
     9  func (Mux) typ() string { return "mux1" }
    10  func (m *Mux) writeForHash(w io.Writer) {
    11  	mustWriteForHash(w, m.Sources)
    12  	mustWriteForHash(w, m.Program)
    13  }
    14  
    15  // NewMux creates a new Mux.
    16  func NewMux(sources []*ValueSource, program *Program) *Mux {
    17  	return &Mux{
    18  		Sources: sources,
    19  		Program: program,
    20  	}
    21  }