code: func (sw *AsyncHasher) Write(i int, section []byte) {
  	sw.mtx.Lock()
  	defer sw.mtx.Unlock()
  	t := sw.getTree()
  	// cursor keeps track of the rightmost section written so far
  	// if index is lower than cursor then just write non-final section as is
  	if i < t.cursor {
  		// if index is not the rightmost, safe to write section
  		go sw.write(i, section, false)
  		return
  	}
  	// if there is a previous rightmost section safe to write section
  	if t.offset > 0 {
  		if i == t.cursor {
  			// i==cursor implies cursor was set by Hash call so we can write section as final one
  			// since it can be shorter, first we copy it to the padded buffer
  			t.section = make([]byte, sw.secsize)
  			copy(t.section, section)
  			go sw.write(i, t.section, true)
  			return
  		}
  		// the rightmost section just changed, so we write the previous one as non-final
  		go sw.write(t.cursor, t.section, false)
  	}
  	// set i as the index of the righmost section written so far
  	// set t.offset to cursor*secsize+1
  	t.cursor = i
  	t.offset = i*sw.secsize + 1
  	t.section = make([]byte, sw.secsize)
  	copy(t.section, section)
  }
docs: // Write writes the i-th section of the BMT base
  // this function can and is meant to be called concurrently
  // it sets max segment threadsafely