code: func calcHashSequence(tx *wire.MsgTx) chainhash.Hash {
  	var b bytes.Buffer
  	for _, in := range tx.TxIn {
  		var buf [4]byte
  		binary.LittleEndian.PutUint32(buf[:], in.Sequence)
  		b.Write(buf[:])
  	}
  
  	return chainhash.DoubleHashH(b.Bytes())
  }
docs: // calcHashSequence computes an aggregated hash of each of the sequence numbers
  // within the inputs of the passed transaction. This single hash can be re-used
  // when validating all inputs spending segwit outputs, which include signatures
  // using the SigHashAll sighash type. This allows validation to re-use previous
  // hashing computation, reducing the complexity of validating SigHashAll inputs
  // from O(N^2) to O(N).